Please look at the following code:
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;
}
}
Why the handler doesn't catch the exception thrown by App constructor?