rethrow currentDomain_unhandledException中的例外?
-
26-10-2019 - |
题
当我的应用程序完全崩溃时,我无法登录它以检查之后发生的事情。如果我想继续像被谋生的那样继续,那是正确的 CurrentDomain_UnhandledException
事件?我不让我的代码继续下去,因为我不知道它处于什么状态。
所以我应该这样做:
static void CurrentDomain_UnhandledException(
object sender,
UnhandledExceptionEventArgs e)
{
if (logger.IsFatalEnabled)
logger.Fatal("A fatal unhandled error occurred.",
(Exception)e.ExceptionObject);
throw (Exception)e.ExceptionObject;
}
或这个?
static void CurrentDomain_UnhandledException(
object sender,
UnhandledExceptionEventArgs e)
{
if (logger.IsFatalEnabled)
logger.Fatal("A fatal unhandled error occurred.",
(Exception)e.ExceptionObject);
}
没有正确的解决方案
不隶属于 StackOverflow