相关疑难解决方法(0)

C++/CLI:捕获所有(.NET/Win32/CRT)异常

我知道这是不赞成的,但我在这里没有选择.我正在开发一个C++/CLI应用程序,它有一个我无法追踪的错误 - 主要是因为它绕过我当前的崩溃处理程序:

AppDomain::CurrentDomain->UnhandledException += gcnew UnhandledExceptionEventHandler(&LogAndExit);
Application::ThreadException += gcnew ThreadExceptionEventHandler(&LogAndExit);
Application::SetUnhandledExceptionMode(UnhandledExceptionMode::CatchException);
try 
{ 
    Application::Run(gcnew frmMain()); 
} 
catch (Exception^ ex) 
{ 
    LogAndExit(ex); 
} 
catch (...) 
{ 
    LogAndExit(); 
}
Run Code Online (Sandbox Code Playgroud)

我想,标准.NET崩溃处理.MSDN报告称,某些CRT异常会破坏托管堆栈并以静默方式中止应用程序.

我一直在阅读_set_invalid_parameter_handler,但即使我收到LNK2001错误,它似乎也不能与/ clr:pure一起使用.我是对的,还是我只是PEBKACing它并丢失了一个lib文件?

.net exception-handling c++-cli

7
推荐指数
1
解决办法
1万
查看次数

标签 统计

.net ×1

c++-cli ×1

exception-handling ×1