From c07220bbf072aaca506a64e8f5c1eacfd80b1696 Mon Sep 17 00:00:00 2001 From: SugarChes Date: Sun, 9 Aug 2026 11:33:20 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=9D=E7=95=99=E6=9C=AA=E5=A4=84?= =?UTF-8?q?=E7=90=86=E5=BC=82=E5=B8=B8=E5=8E=9F=E5=A7=8B=E5=A0=86=E6=A0=88?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- 插件库/Lskj.Main/Program.cs | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) 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); }