Unhandled exceptions in children threads

When an exception is thrown in a thread that is not the main thread, it can be catch with the event UnhandledException of the AppDomain class. However attaching this event can not avoid the application to crash.

There are two ways to workaround this issue:

  1. One of this is managed the exceptions explicitly with try ... catch in each thread, the catch statement would have to handle the exception and not rethrown it.
  2. The second solution is set the CLR work as in the previous versions (1.0 and 1.1). It is not a recommended approach. In order to do that you need add the following configuration setting in your application configuration file:

<runtime>

    <legacyUnhandledExceptionPolicy enabled="1"/>

</runtime>

2 Comments

Comments have been disabled for this content.