KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
I am trying to set up my WPF application so that when an exception goes unhandled, an error dialog pops up. In good ol' WinForms this was possible by adding Application.ThreadException += new System.Threading.ThreadExceptionEventHandler(Application_ThreadException); To your Program.cs file and then showing whatever dialog you wanted in the event handling code. In WPF I've tried to use app.Dispatcher.UnhandledException += new System.Windows.Threading.DispatcherUnhandledExceptionEventHandler(Dispatcher_UnhandledException); However, when I use Show() on my error-handling custom window, the application immediately goes to "blahblah.exe has stopped working..." and closes. If I use ShowDialog(), the window is usable until it's closed and then the same "...has stopped working..." dialog pops up and dies. In WinForms, it seems that closing any error dialog would allow the app to continue running, depending on how severe the exception was. I can't seem to figure out how to properly do this in WPF. Any ideas?
Tags (comma-separated)
Save Edits
Cancel