【发布时间】:2013-09-06 15:14:16
【问题描述】:
我已设置 UnhandledException 以在我的服务崩溃之前记录任何异常。
AppDomain.CurrentDomain.UnhandledException += new UnhandledExceptionEventHandler(unhandledException);
我正在通过抛出未处理的异常来测试它。
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());
}
我正在尝试使用 Log4Net 在我的 unhandledException 方法中记录此内容,但我一无所获。
为什么没有捕获到异常?
【问题讨论】:
-
在这里发布更多代码。