public Window1() {
InitializeComponent();
AppDomain.CurrentDomain.UnhandledException +=
new UnhandledExceptionEventHandler(CurrentDomain_UnhandledException);
}
void CurrentDomain_UnhandledException(object sender, UnhandledExceptionEventArgs e)
{
throw
new NotImplementedException();
}
PS:在web中发现这家伙似乎不起作用,没深入纠结它,而且它阻止不了异常往上报,只能是收集信息用。
二:HttpApplication.Error事件
public
void Init(HttpApplication context)
{
context.BeginRequest +=
new EventHandler(context_BeginRequest);
context.Error +=
new EventHandler(context_Error);
}