title: Exit Code When Unhandled Exception Terminates Execution?
body: <p>When a C# .Net console application terminates due to an unhandled exception, are there rules determining which exit code is returned or is 255 <em>always</em> used?</p>
  
  <p>I haven't been able to find documentation on this. A simple console app that executes <code>throw new Exception()</code> dies with exit code 255. I'd like to know if it's safe to assume that all unhandled exceptions will return this same error code or if there are variations/corner cases I need to be aware of.</p>
  
  <pre><code>C:\Temp\&gt; ThrowsExceptionConsoleApp.exe
  C:\Temp\&gt; echo %errorlevel%
  255
  </code></pre>