トップレベルを追加するWPFアプリケーションがあり、すべてのエラー処理をキャッチします。DispatcherUnhandledException イベントを次のように処理します。
private void App_OnDispatcherUnhandledException(object sender, DispatcherUnhandledExceptionEventArgs e)
{
if (_isHandlingError)
{
_log.Error("Critical unhandled error", e.Exception);
e.Handled = true;
return;
}
_isHandlingError = true;
var vm = _windsorContainer.Resolve<ErrorReporterViewModel>();
Dispatcher.Invoke(() =>
{
vm.Details = FailureMessageBuilder.CreateContent(e.Exception);
var view = new ErrorReporterView { DataContext = vm };
view.Show();
});
e.Handled = true;
NotifyOfException(e.Exception, vm.Description);
_isHandlingError = false;
}
問題は、Show() (または ShowDialog) の呼び出しが返されず、エラー ダイアログが表示されないことです。
問題は何ですか?