我有一个WinForms应用程序,它使用几个C++/CLI,它们依次与Boost链接。由于Boost或std库的一些奇怪之处,当我正常退出这个应用程序时(即使是在它加载之后),它会因为双释放C++语言环境方面而崩溃。为了解决这个问题,我开始使用Process.GetCurrentProcess().Kill()
,但是后来当我需要一个正常的出口来有一个0退出代码(即用于自动测试)时,我转而使用Environment.Exit(0)
。
我刚刚将依赖项从用VS 2010编译的.NET 4和Boost 1.54升级为.NET 4.5,并将使用VS 2013编译的Boost 1.56进行了升级。在升级之前,Environment.Exit(0)
运行良好。升级之后,它将无限期挂起。当我切换回Process.GetCurrentProcess().Kill()
时,它会很好地退出(除了退出代码)。当我让它在没有任何解决方法的情况下正常关闭时,我仍然会遇到locale崩溃(所以我猜Boost或std C++中的问题没有得到解决)。所以我仍然需要解决办法来工作。
我观察到一些奇怪的事情:
你知道是什么原因造成的吗?或者如何解决它?
编辑:这是来自调试构建的堆栈跟踪,它具有相同的症状。更有意义的是,它挂在我的DLL的CRT中。它似乎抛出了一个异常,但我抓不到它?
ntdll.dll!ZwDelayExecution() + 0xa bytes
KernelBase.dll!SleepEx() + 0xb3 bytes
ntdll.dll!RtlpExecuteHandlerForException() + 0xd bytes
ntdll.dll!RtlDispatchException() + 0x38f bytes
ntdll.dll!KiUserExceptionDispatch() + 0x2e bytes
KernelBase.dll!RaiseException() + 0x3d bytes
InteropQonverter.dll!_CRT_INIT(void * hDllHandle, unsigned long dwReason, void * lpreserved) Line 415 C
InteropQonverter.dll!__DllMainCRTStartup(void * hDllHandle, unsigned long dwReason, void * lpreserved) Line 526 + 0x13 bytes C
InteropQonverter.dll!_DllMainCRTStartup(void * hDllHandle, unsigned long dwReason, void * lpreserved) Line 477 C
mscoreei.dll!000007fef8405795()
[Frames below may be incorrect and/or missing, no symbols loaded for mscoreei.dll]
mscoree.dll!ShellShim__CorDllMain() + 0xe1 bytes
mscoree.dll!_CorDllMain_Exported() + 0x37 bytes
ntdll.dll!LdrShutdownProcess() + 0x1d1 bytes
ntdll.dll!RtlExitUserProcess() + 0x90 bytes
mscoreei.dll!000007fef83f3067()
mscoreei.dll!000007fef83f3300()
mscorlib.ni.dll!000007fef706188b()
[Managed to Native Transition]
mscorlib.dll!System.Environment.Exit(int exitCode) + 0x7b bytes
IDPicker.exe!IDPicker.IDPickerForm.IDPickerForm_FormClosing(object sender, System.Windows.Forms.FormClosingEventArgs e) Line 1593 + 0x7 bytes C#
发布于 2014-12-19 10:54:02
我追踪到了一个“无效字符串绑定”错误,这就是我首先添加Kill()/Exit()调用的原因。然后,当我在:0xC0020001: The string binding is invalid. - Only occurring in WPF (我在C++/ClI的链接器选项中添加了/NOENTRY
)时,我显然改变了一些东西。
https://stackoverflow.com/questions/27510456
复制相似问题