You can trap unhandled exceptions at different levels:
AppDomain.CurrentDomain.UnhandledException
Dispatcher.UnhandledException
Application.Current.DispatcherUnhandledException
TaskScheduler.UnobservedTaskException
You should consider what level you need to trap unhandled exceptions at.
Deciding between #2 and #3 depends upon whether you're using more than one WPF thread. This is quite an exotic situation and if you're unsure whether you are or not, then it's most likely that you're not.
2.1m questions
2.1m answers
60 comments
56.8k users