我已经试过了,但它似乎不起作用:
Application.SetUnhandledExceptionMode(UnhandledExceptionMode.CatchException);
Application.ThreadException += new System.Threading.ThreadExceptionEventHandler(Application_ThreadException);
AppDomain.CurrentDomain.UnhandledException += new UnhandledExceptionEventHandler(CurrentDomain_UnhandledException);
static void CurrentDomain_UnhandledException(object sender, UnhandledExceptionEventArgs e)
{
//suppress ???
}
static void Application_ThreadException(object sender, System.Threading.ThreadExceptionEventArgs e)
{
//suppress ???
}
请您参考如下方法:
按 Ctrl+D、E,然后取消选中您不希望调试器中断的异常。
编辑:如果对话框不起作用,您也可以按照these answers 中的描述通过宏来完成。 .
