问题标签 [comexception]

For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.

0 投票
1 回答
1499 浏览

c# - C# - UrlHistoryWrapper 类 - 没有足够的存储空间来处理此命令。(来自 HRESULT 的异常:0x80070008)

我正在从数据库中获取值,并尝试使用 UrlHistoryWrapper 类将它们插入到 Internet Explorer 历史记录中。当我将for条件设置为数千时,我会收到此错误,但是,当我将 for 条件设置为小于 100 时,它会运行良好。我检查了内存使用情况,应该没有问题。如果 chrome.URLs 和 firefox.URLs 有数千个值,我怎样才能使这段代码能够运行?

这是我的代码:

这是我的错误:

** * **异常文本** * **** System.Runtime.InteropServices.COMException (0x80070008):没有足够的存储空间来处理此命令。(HRESULT 异常:0x80070008)在 UrlHistoryLibrary.UrlHistoryWrapperClass.AddHistoryEntry(String pocsUrl,String pocsTitle,ADDURL_FLAG dwIE(String pocsUrl,String pocsTitle,ADDURL_FLAG dwFlags)在 Namespace.IE)中的 UrlHistoryLibrary.IUrlHistoryStg2.AddUrl(String pocsUrl,String pocsTitle,ADDURL_FLAG dwFlags)。 \Users\Chris\documents\visual studio 2010\Projects\TestURLGUI4\TestURLGUI4\URLHistory.cs:C:\Users\Chris\documents\visual studio 2010\Projects\TestURLGUI4\TestURLGUI4 中 Namespace.Program.SyncAll() 的第 270 行\URLHistory.cs:TestURLGUI2.Form1.button11_Click(Object sender, EventArgs e) 中的第 152 行:\Users\Chris\documents\visual studio 2010\Projects\TestURLGUI4\TestURLGUI4\Form1.cs:System.Windows 中的第 247 行.

Edit:

Here is my new code:

Now, with this code, I can go up to 8447 without getting this error, but then it gets thrown.

I had someone else try to do this, and this is what he said:

Just tried your code and and it seems that there is a limit on the number of the url records that can be added. I did the following steps.

  1. In Internet Explorer, Clear the history of websites I've visited.
  2. I tried your code.
  3. Got a COMException (0x80070008): Not enough storage is available to process this command. The exception is thrown at record number 41021 for me (Windows 7, 64bit).
  4. I tried your code again, and Got a very same exception. This time, No record have be added. To add the url records again. I have to clear the history of websites in Internet Explorer. I could not find a way to fix the problem.

For anyone who needs to know, the source code for the URLhistoryWrapper can be found on this CodeProject project.

0 投票
1 回答
1644 浏览

c# - “/”应用程序中的服务器错误

当我在本地运行我的代码时,没问题..但是当我在服务器上运行我的代码时,我遇到了这个错误:

它给出了这一行的错误:

excelObj = new Microsoft.Office.Interop.Excel.Application();

这是描述:

此错误与我的代码或我的服务器有关吗?

提前致谢..在此处输入图像描述

0 投票
2 回答
389 浏览

wpf - 来自 UIAutomationProvider 的 ComException

当以前可见的 MenuItem 变为隐藏时,DotNet 4.0 会引发运行时 ComException。切换到 DotNet 3.5 时,不再抛出异常。

设置

  • 创建新的 WPF DotNet 4.0 项目
  • 将以下 XAML 代码添加到默认网格

    <Menu Height="23"> <MenuItem Header="Item1"> <MenuItem Header="SubItem1"/> </MenuItem> <MenuItem Header="Item2"> <MenuItem Header="SubItem2" /> </MenuItem> </Menu>

  • 确保在 Debug->Exceptions 下选中“Common Language Runtime Exceptions”

  • 运行应用程序并单击第一个菜单项,然后单击第二个菜单项,然后将鼠标指针移回第一个菜单项

有谁知道解决此问题的特定方法?

0 投票
1 回答
343 浏览

c# - 为什么 VS2010 在 COMException 上停止,如果存在 try catch 并且异常设置设置为第一次不抛出

我有以下代码:

我将异常对话框配置为不停止任何处理:

在此处输入图像描述

无论如何 VS 在以下异常上停止并且无法继续执行。有任何想法吗?

在此处输入图像描述

0 投票
2 回答
14487 浏览

c# - 执行 PowerPoint 自动化时如何避免 RPC_E_CALL_REJECTED 异常?

当我的代码尝试创建 的新实例时Microsoft.Office.Interop.PowerPoint.Application,有时会出现以下异常:

我有时会说,因为即使给出相同的输入,它也不会始终如一地发生。此外,它也发生在我也与 PowerPoint 自动化 API 交互的代码的其他部分(同样缺乏一致性)。

我已经从 MSDN 本身尝试了这个解决方案,这似乎是最推荐的解决方案。但是,它似乎没有任何影响,因为我仍然观察到相同的行为。

我的问题是:

  1. MSDN 解决方案是否适用于 PowerPoint 自动化?
  2. 如何验证我是否已将其正确应用到我的代码中?
  3. 有没有人有替代解决方案?

我正在使用 C#、.NET 4 和 PowerPoint 2007。

0 投票
0 回答
232 浏览

.net - COMException 未触发 AppDomain.UnhandledException 事件

我有一个控制台应用程序,其代码如下所示(简化):

为什么COMException不触发UnhandledException事件?

在我的真实代码中,DAO 的东西在一个单独的类中。我尝试catch了 COMException 并再次抛出它,如下所示:

然而,这也没有奏效。 我不明白什么?

顺便说一句,这确实有效,但我不想这样做:

让风滚草开始吧!

0 投票
4 回答
71972 浏览

c# - 如果未安装 Excel,如何创建 Excel 实例

在我的 C# 应用程序中,借助 Excel Interop dll(作为参考),我正在读取/写入 excel 文件。如果我将此程序移动到未安装 office/excel 的系统(想想干净的机器),我会遇到以下错误。

System.Runtime.InteropServices.COMException (0x80040154):检索具有 CLSID {00024500-0000-0000-C000-000000000046} 的组件的 COM 类工厂失败,原因是以下错误:80040154 未注册类(来自 HRESULT 的异常:0x80040154(REGDB_E_CLASSNOTREG) ))。

由于目标机器上没有 excel,因此预计会出现上述错误。
我的问题是,除了在目标机器上注册 Interop dll 之外,还有其他方法可以使用我的程序吗?

0 投票
2 回答
2477 浏览

c# - 区分 Excel 互操作操作引发的异常

我正在使用Microsoft.Office.Interop.Excel库从我的 C# 应用程序中将数据导出到 Excel。

sheet.Cells[currentRow, 1])使用无效currentRow值调用,会产生一条System.Runtime.InteropServices.COMException消息:

ErrorCode-2146827284

但是,我收到了完全相同的错误代码,用于命令 Excel 保存到写保护文件。

有没有办法区分从 Excel 收到的 COMExceptions,以便我可以相应地处理它们? 我不想让我的用户说“使用 Excel 时出了点问题,对不起,傻瓜”。

0 投票
1 回答
1746 浏览

c# - C# > UPnP - COMException:PerUser 订阅的所有者未登录到指定的系统(来自 HRESULT 的异常:0x80040210)

我正在尝试使用 UPnP 协议使用 C#.net 应用程序与兼容 dlna 的设备进行通信。我正在使用默认的 Visual Studio UPnP 库(“UPnP 1.0 类型库(控制点)”)。我列出了所有使用 UPNPDeviceFinder.FindByType 的渲染设备。一切正常...

现在我使用以下函数获得 AVTransport 服务:

我尝试向这样的设备发送播放命令:

在最后一行,我收到以下错误:

COMException:PerUser 订阅的所有者未登录到指定的系统(来自 HRESULT 的异常:0x80040210)

这是什么意思。完全不清楚为什么会发生此异常。

谢谢,托马斯

0 投票
1 回答
1001 浏览

c# - 保存只读 Word 文档会在 VSTO 中引发 COMException

在我的 Word 加载项中打开 Word 文档时,我会验证该文档。验证需要保存文档,所以我调用 save 方法:

如果文档是只读的(我的用例是从 Outlook 打开附加的文档),则另存为对话框打开。如果我保存文档或点击取消,两种情况都会引发 COMException,并显示消息“此文件是只读的。(文件名。)”。

通常,会为 Cancel 引发用户取消 COMException,如果文件保存正确,我希望不会引发异常。这是一个错误还是我需要以不同的方式处理文件?