title: Getting ExitCode From Exception Handler
body: <p>I have following error handler in my console application</p>
  
  <p><strong>Main Procedure:</strong></p>
  
  <pre><code>AppDomain.CurrentDomain.UnhandledException +=
                  new UnhandledExceptionEventHandler(ErrorHandler);
  </code></pre>
  
  <p><strong>Handler Procedure:</strong></p>
  
  <pre><code>static void ErrorHandler(object sender, UnhandledExceptionEventArgs args)
          {
              Exception e = (Exception)args.ExceptionObject;
              ... Loging Error ...
              //Environment.Exit(?);
          }
  </code></pre>
  
  <p>And the problem is that error is logged but after that application failed and windows popup (application is not responding) is showed.</p>
  
  <p>So i want to add Environment.Exit() to prevent that behavior, but how to specify the exitCode from the exception ? I dont want to set Exit(0) (which means everything is okay) because i also want see the error (only information that some error happened, exception is already logged) in the scheduler application which trigger this script.</p>
  
  <p>Thank you </p>