I am currently maintaining a WinForms application that listens to the Application.ThreadException
event to trap unhandled exceptions on GUI threads.
Now things have been working as expected until recently. But lately, this event is no longer being raised appropriately on some production boxes; the app skips the handler and just crashes when there is an unhandled exception on a GUI thread. Strangely, I am able to reproduce this on my (new) dev box, but there are some machines on which the event is in fact being raised correctly.
I am able to make the behaviour consistent by explicitly setting the policy like this:
Application.SetUnhandledExceptionMode(UnhandledExceptionMode.CatchException);
But I am curious to know what controls the default policy. MSDN makes vague allusions to an "application configuration file", but there is no such policy-setting in our app.config or any other configuration file that I know of.
What is causing this inconsistent behaviour?