我们正在尝试实例化一个OCX组件,但它会生成一个不会被try / catch捕获的异常。
从资源管理器启动应用程序时,窗口会要求在“调试”或“关闭”应用程序之间进行选择。当我选择Debug时,Visual Studio 2012启动,我收到以下消息:
Unhandled exception at 0x779ae753 in TestFwComponent.exe: 0xC0000374: A heap has been corrupted.
First-chance exception at 0x770ac41f in TestFwComponent.exe: Microsoft C++ exception: COleDispatchException at memory location 0x0022e228.
First-chance exception at 0x770ac41f in TestFwComponent.exe: Microsoft C++ exception: [rethrow] at memory location 0x00000000.
First-chance exception at 0x770ac41f in TestFwComponent.exe: Microsoft C++ exception: EECOMException at memory location 0x0022e5b0.
First-chance exception at 0x770ac41f in TestFwComponent.exe: Microsoft C++ exception: [rethrow] at memory location 0x00000000.
First-chance exception at 0x770ac41f in TestFwComponent.exe: 0xE0434352: 0xe0434352.
First-chance exception at 0x770ac41f in TestFwComponent.exe: 0xE0434352: 0xe0434352.
奇怪的是,当我直接使用VS2012的调试器启动应用程序时,我可以获得异常并继续执行。是的,它很脏但是这个组件是废话,我们必须在使用之前生成异常..
System.Runtime.InteropServices.SEHException was caught
HResult=-2147467259
Message=External component has thrown an exception.
Source=mscorlib
ErrorCode=-2147467259
StackTrace:
at System.RuntimeType.ForwardCallToInvokeMember(String memberName, BindingFlags flags, Object target, Int32[] aWrapperTypes, MessageData& msgData)
at FwWFLib.FwWFClass.Initialize(String ServerMachineName, String MbxName, String MbxServerProcessName, Object Controls)
at MDT.MicroBackFill.FWClient.Core.Service.FwService.Initialize() in c:\TEMP\TestFwComponent\FwService.cs:line 49
InnerException:
我想知道如何在没有debbuger的情况下尝试/捕获生成的异常?