不能正常捕捉异常

最近主工程切换到了MFC application, 发现在debug模式下不能edit and continous,在网上找了半天,才知道可以通过设置Debugger type 到Managed Only,恢复C#的edit and contious功能。

新的问题来了:只要应用程序有任何未处理的异常,就直接crash,抛出系统错误框,如下图:

untitled

如果将Debugger type改回原来的Auto设置可以捕捉到异常,但确是如下的:

EasyCapture1

 

各位可知如何能够弹出如下的异常框:

untitled2

还有发现现在的CER 模块也不work了,是不是在MFC的环境下如下代码不起作用了:

Application.ThreadException += new ThreadExceptionEventHandler(OnGuiUnhandledException);
// For CLR unhandled exceptions
Application.SetUnhandledExceptionMode(UnhandledExceptionMode.CatchException);
AppDomain.CurrentDomain.UnhandledException += new UnhandledExceptionEventHandler(OnUnhandledException);

posted @ 2008-07-31 12:45  Anders06  阅读(344)  评论(0编辑  收藏  举报