How to catch exceptions in Main()

  • Thread starter Thread starter love_hiking
  • Start date Start date
L

love_hiking

I try to catch possible exceptions in a Windows forms program. I put a catch
block as the last resort if other part of my program doesn't catch them. It
works if I use Visual Studio debugger. But, it will not go into the catch
block without Visual Studio attached. Does anyone know what is going on and
what is the best way to do this? Thanks very much for your help.

try
{
Application.Run(main);
}
catch (Exception ex)
{
......
}
 
Back
Top