AppDomain.CurrentDomain.UnhandledException += new UnhandledExceptionEventHandler(CurrentDomain_UnhandledException);
Application.SetUnhandledExceptionMode(UnhandledExceptionMode.ThrowException); // if no, do not catch UI thread exception
void CurrentDomain_UnhandledException(object sender, UnhandledExceptionEventArgs e)
{
Exception exception = e.ExceptionObject as Exception;
// Write log or do other opts.
}
MSDN: http://msdn.microsoft.com/en-us/library/ms954599.aspx
Application.SetUnhandledExceptionMode(UnhandledExceptionMode.ThrowException); // if no, do not catch UI thread exception
void CurrentDomain_UnhandledException(object sender, UnhandledExceptionEventArgs e)
{
Exception exception = e.ExceptionObject as Exception;
// Write log or do other opts.
}
MSDN: http://msdn.microsoft.com/en-us/library/ms954599.aspx
浙公网安备 33010602011771号