diff --git a/插件库/Lskj.Main/Program.cs b/插件库/Lskj.Main/Program.cs
index d1cefe9..2f1274f 100644
--- a/插件库/Lskj.Main/Program.cs
+++ b/插件库/Lskj.Main/Program.cs
@@ -284,8 +284,20 @@ namespace Lskj.Main
/// The instance containing the event data.
private static void CurrentDomain_UnhandledException(object sender, UnhandledExceptionEventArgs e)
{
- Console.WriteLine(e.ExceptionObject.ToString());
- MessageUtil.Show(e.ExceptionObject.ToString());
+ Exception exception = e == null
+ ? null
+ : e.ExceptionObject as Exception;
+ if (exception == null)
+ {
+ exception = new Exception(
+ e == null || e.ExceptionObject == null
+ ? "AppDomain 未处理异常对象为空。"
+ : e.ExceptionObject.ToString());
+ }
+
+ Console.WriteLine(exception);
+ LogHelper.Instance.WriteError(exception);
+ MessageUtil.Show(exception);
}