c# - Trying to showing a dialog on DispatcherUnhandledException -
i have wpf application i'm adding top level, catch error handling. handle dispatcherunhandledexception event so:
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; } the problem is, call show() (or showdialog) never returns, , error dialog never shown.
what might issue?
do have attached event application?
capp.dispatcher.unhandledexception += new dispatcherunhandledexceptioneventhandler(dispatcher_unhandledexception); capp.initializecomponent(); capp.run(new mainwindow()); and then
private static void dispatcher_unhandledexception(object sender, dispatcherunhandledexceptioneventargs e) { ...e.exception.message }
Comments
Post a Comment