“System.Runtime.InteropServices.COMException”类型的第一次机会异常在 System.Windows.Forms.dll 中发生
最近做一个winform项目,在里面用了webbrowser控件进行html文档打印,遇到了标题所示问题。根据查到的一些资料,在调试》异常》查找中输入“System.Runtime.InteropServices.COMException”,勾选查找到的项目后的复选框。重新调试程序,终于爆出了真正的问题:试图吊销一个未注册的拖放目标 (异常来自 HRESULT:0x80040100 (DRAGDROP_E_NOTREGISTERED))。
查看原来的代码:
browser.DocumentText = text;
browser.Print();
该段代码做如下修改后问题解决:
browser.DocumentText = ""; // 不加这一句,Document对象可能为null,导致下一句代码出错
browser.Document.Write(text);
browser.Print();
“System.Runtime.InteropServices.COMException”类型的第一次机会异常在 System.Windows.Forms.dll 中发生的更多相关文章
- “System.Runtime.InteropServices.COMException”类型的第一次机会异常在 ESRI.ArcGIS.Version.dll 中发生
“System.Runtime.InteropServices.COMException”类型的第一次机会异常在 ESRI.ArcGIS.Version.dll 中发生 其他信息: The speci ...
- System.AccessViolationException”类型的第一次机会异常在 System.Data.dll 中发生 其他信息: 尝试读取或写入受保护的内存。这通常指示其他内存已损坏。
管理员cmd中运行 netsh winsock reset
- System.Runtime.InteropServices.COMException: Exception from HRESULT: 0x800AC472
更新至服务器后运行出错: System.Runtime.InteropServices.COMException: Exception from HRESULT: 0x800AC472 解决方法 注册 ...
- System.Runtime.InteropServices.COMException (0x800706BA) 解决方法
提示“操作失败:无法获取MAC地址.”错误的解决方法. .NET 获取 MAC地址可能会遇到 System.Runtime.InteropServices.COMException (0x8007 ...
- Visual Studio 2008 – ASP.NET “System.Runtime.InteropServices.COMException”
The Issue When openning an existing ASP.NET project for the first time in Visual Studio 2008 it retu ...
- VS2008,System.Runtime.InteropServices.COMException (0x800401F3): Invalid class string (Exception from HRESULT: 0x800401F3 (CO_E_CLASSSTRING))
在VS2008环境中编译调试运行不报错,但在发布的exe文件运行就报错 System.Runtime.InteropServices.COMException (0x800401F3): Invali ...
- System.Runtime.InteropServices.COMException (0x800A03EC): 无法访问文件
使用Microsoft.Office.Interop.Excel 操作 今天在服务器部署,操作程序csv文件转xsl文件的时候,遇到一下问题: System.Runtime.InteropServic ...
- System.Runtime.InteropServices.COMException 检索COM类工厂中CLSID{xxxxxxxxx}的组件时失败解决方法
iis7.5中设定应用程序池中<进程模型>中<标识>为localSystem 提示:System.Runtime.InteropServices.COMException: 命 ...
- excel System.Runtime.InteropServices.COMException (0x80010105): 服务器出现意外情况。 (异常来自 HRESULT:0x80010105 (RPC_E
System.Runtime.InteropServices.COMException (0x80010105): 服务器出现意外情况. (异常来自 HRESULT:0x80010105 (RPC_E ...
随机推荐
- memcache简单操作
<?php $m = new Memcache(); $m->connect('localhost',11211); //获取版本 echo "server's version: ...
- C&C++内存布局
1. Memory Layout of a C Program http://codingfreak.blogspot.com/2012/03/memory-layout-of-c-program-p ...
- Executor(二)ThreadPoolExecutor、ScheduledThreadPoolExecutor 及 Executors 工厂类
Executor(二)ThreadPoolExecutor.ScheduledThreadPoolExecutor 及 Executors 工厂类 Java 中的线程池类有两个,分别是:ThreadP ...
- 在mac console下 执行c++文件
1 $ g++ -o NewFileName OldFileName.cpp -o is the letter O not zero NewFileName will be your executab ...
- NAND FLASH和LCD电路图
- pageX/pageY,screenX/screenY,clientX/clientY的差别
pageX/pageY,screenX/screenY,clientX/clientY的差别 $(document).click(function(e){ //x方向无差别 //alert(e.pag ...
- linux tty设置详解
http://blog.csdn.net/againyuan/article/details/3905380 linux串口termios NAME termios, tcgetattr, tcset ...
- 492. Construct the Rectangle
static int wing=[]() { std::ios::sync_with_stdio(false); cin.tie(NULL); ; }(); class Solution { publ ...
- 2018.10.12 NOIP模拟 棋盘问题(切比雪夫距离)
传送门 貌似是防ak题? 考试的时候想到了做四次cdqcdqcdq于是给自己多套了一个lognlognlogn结果还MLEMLEMLE 0分.(记得最后5分钟调出来的时候是那么的欣喜 下来发现并不需要 ...
- Mac pro 安装IntelliJ IDEA 2017版
1.官网下载这个版本https://www.jetbrains.com 2.点击下载即可 3.下载好后放入本地 4.启动mac终端进行破解 输入命令:sudo vim /private/etc/hos ...