static void CurrentDomain_UnhandledException(object sender, UnhandledExceptionEventArgs e) { XTrace.WriteLine("" + e.ExceptionObject); if (e.IsTerminating) { XTrace.WriteLine("异常退出!"); XTrace.WriteMiniDump(null); MessageBox.Show("" + e.ExceptionObject, "异常退出", MessageBoxButtons.OK, MessageBoxIcon.Error); } }