I've setup the UnhandledException to log any exceptions before my service crashes.
AppDomain.CurrentDomain.UnhandledException += new UnhandledExceptionEventHandler(unhandledException);
I'm testing this by throwing and unhandled exception.
throw new Exception("TestExcepion");
private void unhandledException(object sender, UnhandledExceptionEventArgs e)
{
// Logs to Log4Net but its not reaching here.
Log.Info("Unhandled Exception: " + (e.ExceptionObject as Exception).ToString());
}
I'm attempting to log this within my unhandledException
method using Log4Net but im getting nothing.
Why isn't the exception being caught?