문제

When my app crashes totally, I wan't to be able to log that to check what happened after. If I want to continue like it was uncaught, is it correct to rethrow in the CurrentDomain_UnhandledException event? I don't to be let my code continue as I do not know what state it is in.

So should I do this:

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;
}

or this?

static void CurrentDomain_UnhandledException(
    object sender, 
    UnhandledExceptionEventArgs e)
{
    if (logger.IsFatalEnabled)
        logger.Fatal("A fatal unhandled error occurred.", 
            (Exception)e.ExceptionObject);
}

올바른 솔루션이 없습니다

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top