Search code examples
c#wpfapplication-shutdown

If unhandled exception happens I need to shutdown the WPF Application?


I have a WPF Application basically the exe is a loader for the application UI and sometimes when a unhandled execption occurs the message box is shown and when I click ok it goes away,the UI vanishes etc..,the instance of the exe is still there,I need some mechanism that when and exception that is unhandled occurs shutdown the exe since i have code that checks for multiple instances so the user would have to kill the crashed instance.Any suggestions or code?


Solution

  • You can handle these exceptions in the Application.DispatcherUnhandledException event