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)
{
......
}
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top