title: Unhandled exception in a thread spawned by a third-party dll - .net
body: <p>This is a follow up on:
  <a href="https://stackoverflow.com/questions/29087947/unhandled-dividebyzero-exception-from-an-external-dll-c-sharp">Unhandled DivideByZero exception from an external DLL - C#</a></p>
  
  <p>I have a .net 4.0 application referencing a 3rd-party dll. One of the methods exposed by this dll internally spawns a thread, that at times throws a DivideByZero exception. Because the thread throwing the exception is different than the one calling the method, I cannot use try-catch to block the exception from propagating and crashing the program.</p>
  
  <p>I used a handler to the following event, but while it does get called and allows
  logging, it doesn't really "catch" the exception, which continues to propagate up.</p>
  
  <pre><code> AppDomain currentDomain = AppDomain.CurrentDomain;
   currentDomain.UnhandledException += new UnhandledExceptionEventHandler(MyHandler);
  </code></pre>
  
  <p>Any idea what can be done to block the exception from crashing the program?</p>