fix: 保留未处理异常原始堆栈
This commit is contained in:
@@ -284,8 +284,20 @@ namespace Lskj.Main
|
|||||||
/// <param name="e">The <see cref="ThreadExceptionEventArgs"/> instance containing the event data.</param>
|
/// <param name="e">The <see cref="ThreadExceptionEventArgs"/> instance containing the event data.</param>
|
||||||
private static void CurrentDomain_UnhandledException(object sender, UnhandledExceptionEventArgs e)
|
private static void CurrentDomain_UnhandledException(object sender, UnhandledExceptionEventArgs e)
|
||||||
{
|
{
|
||||||
Console.WriteLine(e.ExceptionObject.ToString());
|
Exception exception = e == null
|
||||||
MessageUtil.Show(e.ExceptionObject.ToString());
|
? 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);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user