Application ThreadException 事件内需要处理异常
Application ThreadException 事件内需要处理异常program.cs文件,Application_ThreadException事件用于处理系统内未截获的异常,若此事件也产生异常会导致系统崩溃,如下图:
C# Code:
private static void Application_ThreadException(object sender, ThreadExceptionEventArgs e)
{
try
{
OperateLog.Write(e.Exception.Message);
Msg.ShowException(e.Exception);
}
catch (Exception ex)
{
Msg.ShowError("Application_ThreadException:\r\n" ex.Message);
}
}
扫一扫加作者微信