I have an application that is mixed Winforms and WPF. In Winforms, I have a global exception handler that is defined as follows:
AppDomain.CurrentDomain.UnhandledException += CurrentDomain_UnhandledException;
Application.ThreadException += Application_ThreadException;
This ALWAYS catches exceptions anywhere in my application that occur that are not expected and handled gracefully.
For WPF, all I seem to be able to capture is:
wpfAppDomain = new System.Windows.Application();
wpfAppDomain.DispatcherUnhandledException +=
wpfAppDomain_DispatcherUnhandledException;
This does NOT always catch global exceptions, and I often find that exceptions are swallowed somewhere and I'm not sure why.
How can I make a global exception handler for WPF that can catch any exception that occurs that is unhandled?