I throw various custom exceptions thoughout my code.
Some of these are recoverable from, so I want a global handler to catch them, display a warning, then carry on.
I have found the AppDomain.UnhandledException event which has an IsTerminating argument, but this is read only.
Is there some event or other way to catch exceptions globally that still lets you handle them and carry on?
(This is in Forms, but I’d be interesting in a WPF solution too)
Have found the solution. Use
Application.ThreadExceptioninstead ofAppDomain.UnhandledException. But you must also tell it to give exceptions on the UI thread too: