title: Why Unhandled exception tricks not working in all cases
body: <p>I ve got an application that runs on many computers (Win 7/10/Server 2012/2016)
  Sometime I've got this issue.</p>
  <pre><code>Faulting application name: app_manager.exe, version: 4.12.16.0, time stamp: 0x5efca010
  Faulting module name: KERNELBASE.dll, version: 10.0.18362.815, time stamp: 0xb89efff3
  ...
  
  Exception Info: System.Net.Sockets.SocketException
     at System.Net.Sockets.Socket.BeginReceive(Byte[], Int32, Int32, System.Net.Sockets.SocketFlags, System.AsyncCallback, System.Object)
     at app_manager.FormSystray.AcceptCallback(System.IAsyncResult)
     at System.Net.LazyAsyncResult.Complete(IntPtr)
     at System.Threading.ExecutionContext.RunInternal(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object, Boolean)
     at System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object, Boolean)
     at System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object)
     at System.Net.ContextAwareResult.Complete(IntPtr)
     at System.Net.LazyAsyncResult.ProtectedInvokeCallback(System.Object, IntPtr)
     at System.Net.Sockets.Socket.AcceptCallback(System.Object)
     at System.Net.Sockets.Socket.RegisteredWaitCallback(System.Object, Boolean)
     at System.Threading._ThreadPoolWaitOrTimerCallback.PerformWaitOrTimerCallback(System.Object, Boolean)
  
  </code></pre>
  <p>It's seems this code bellow not work in every case.</p>
  <pre><code>    [HandleProcessCorruptedStateExceptions]
      [SecurityCritical]
      [STAThread]
      static void Main(String[] aCmdLine)
      {
          ...
  
          // Set the unhandled exception mode to force all Windows Forms errors to go through our handler.
          // Add the event handler for handling non-UI thread exceptions to the event. 
          Application.ThreadException += new ThreadExceptionEventHandler(Application_ThreadException);
          Application.SetUnhandledExceptionMode(UnhandledExceptionMode.CatchException);
          AppDomain.CurrentDomain.UnhandledException += new UnhandledExceptionEventHandler(CurrentDomain_UnhandledException);
  </code></pre>
  <p>My only function that use AcceptCallback was place in a try catch !</p>
  <pre><code>oListener.BeginAccept(new AsyncCallback(AcceptCallback), oListener);
  </code></pre>
  <p>Did someone have any idea to handle all exception.</p>
  <p>Thanks in advance ...</p>