title: How can I make something that catches all 'unhandled' exceptions in a WinForms application?
body: <p>Up until now, I just put a try/catch block around the <code>Application.Run</code> in the <code>Program.cs</code> entry point to the program. This catches all exceptions well enough in Debug mode, but when I run the program without the debug mode, exceptions don't get handled anymore. I get the unhandled exception box.</p>
  
  <p>I don't want this to happen. I want all exceptions to be caught when running in non-debug mode. The program has multiple threads and preferably all exceptions from them get caught by the same handler; I want to log exceptions in the DB. Does anyone have any advice in how to do this?</p>