C# CurrentDomain中的Rethrow异常\u未处理的异常?

C# CurrentDomain中的Rethrow异常\u未处理的异常?,c#,exception-handling,unhandled-exception,C#,Exception Handling,Unhandled Exception,当我的应用程序完全崩溃时,我无法将其记录下来以检查之后发生了什么。 如果我想像未捕获一样继续,那么在CurrentDomain\u UnhandledException事件中重新刷新是否正确?我不想让我的代码继续,因为我不知道它处于什么状态 因此,我应该这样做: static void CurrentDomain_UnhandledException( object sender, UnhandledExceptionEventArgs e) { if (logger.

当我的应用程序完全崩溃时,我无法将其记录下来以检查之后发生了什么。 如果我想像未捕获一样继续,那么在
CurrentDomain\u 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);
}

调用此事件时,AppDomain已将终止。事实上,如果你想的话,你不能中止它。@Dan这应该是一个答案,而不是评论