【发布时间】:2020-05-09 13:50:32
【问题描述】:
请看以下代码:
public partial class App : Application
{
public App():base()
{
this.DispatcherUnhandledException += App_DispatcherUnhandledException;
throw new InvalidOperationException("exception");
}
private void App_DispatcherUnhandledException(object sender, System.Windows.Threading.DispatcherUnhandledExceptionEventArgs e)
{
MessageBox.Show(e.Exception.Message);
e.Handled = true;
}
}
为什么处理程序没有捕捉到 App 构造函数抛出的异常?
【问题讨论】: