Another thing that’s been kicking around for awhile and I figured it was time to persist to long-term storage. Here are the three top-level places in a WinForms app where you absolutely need exception handling routines to ensure that all exceptions are caught:



  1. try/catch around Main()
  2. Attach a System.Threading.ThreadExceptionEventHandler to Application.ThreadException
  3. Attach a UnhandledExceptionEventHandler to AppDomain.CurrentDomain.UnhandledException

Note that simply having a try/catch around Main() is insufficient as you will not catch exceptions that occur during the execution of event handlers or asynchronous callbacks.