Mal*_*olm 10 wpf exception-handling
我开始在VS2008一个新的WPF项目,然后添加一些代码的陷阱DispatcherUnhandledException
.然后我说一抛异常Window1
但错误没有被处理程序捕获.为什么?
public App()
{
this.DispatcherUnhandledException += new DispatcherUnhandledExceptionEventHandler(App_DispatcherUnhandledException);
}
void App_DispatcherUnhandledException(object sender, DispatcherUnhandledExceptionEventArgs e)
{
System.Windows.MessageBox.Show(string.Format("An error occured: {0}", e.Exception.Message), "Error");
e.Handled = true;
}
void Window1_MouseDown(object sender, MouseButtonEventArgs e)
{
throw new NotImplementedException();
}
Run Code Online (Sandbox Code Playgroud)
归档时间: |
|
查看次数: |
13401 次 |
最近记录: |