fix: 保留未处理异常原始堆栈

This commit is contained in:
2026-08-09 11:33:20 +08:00
parent 219caba818
commit c07220bbf0
+14 -2
View File
@@ -284,8 +284,20 @@ namespace Lskj.Main
/// <param name="e">The <see cref="ThreadExceptionEventArgs"/> instance containing the event data.</param>
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);
}