rmmarsh
asked on
Some exceptions not being caught by handlers
I have this code in my Program.cs file:
When I throw an exception like this: throw new InvalidConstraintException ();
I get an error message that the exception was unhandled. (there is code to handle the exception, but it's not being called)
What am I doing wrong?
// Add the event handler for handling UI thread exceptions to the event.
Application.ThreadException += new ThreadExceptionEventHandler(mainForm.Form1_UIThreadException);
// Add the event handler for handling non-UI thread exceptions to the event.
AppDomain.CurrentDomain.UnhandledException += new UnhandledExceptionEventHandler(mainForm.CurrentDomain_UnhandledException);
Application.Run(new mainForm());
When I throw an exception like this: throw new InvalidConstraintException
I get an error message that the exception was unhandled. (there is code to handle the exception, but it's not being called)
What am I doing wrong?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER