title: How to catch unhandled exceptions thrown in AutoCAD.NET
body: <p>In my Autocad.NET app I want to log all unhandled exceptions using log4net. AutoCAD itself shows an error dialog with a detailed message -> so there must be a way to register to a certain event.</p>
  
  <p>I tried to register the <code>AppDomain.CurrentDomain.UnhandledException</code> event at app initialization:</p>
  
  <pre><code>AppDomain.CurrentDomain.UnhandledException += (s, e) =&gt;
  {
       System.Exception exception = (System.Exception)e.ExceptionObject;
       log.Error(String.Format("Unhandled Exception: {0}\n{1}", exception.Message, exception.StackTrace));
  };
  </code></pre>
  
  <p>But this event is never fired. </p>