Reputation: 289
I've installed visual studio 2010.
When unhandled exception is thrown, nothing happen...
I created new windows form application and wrote 1 line in the form_load function:
private void Form1_Load(object sender, EventArgs e)
{
throw new Exception("");
}
And still nothing happen. The only thing I can see is the "A first chance exception of type 'System.Exception' occurred in WindowsFormsApplication1.exe" in the output window.
It looks like this error was catch but I dont know how... (This line is the only line I wrote in this project).
How can I solve this issue?
Thanks!
Upvotes: 1
Views: 274
Reputation: 3428
You could also register your program for the UnhandledExceptionEvent
. To do so write the following into your Program.cs before calling Application.Run(new MyForm())
:
AppDomain.CurrentDomain.UnhandledException += OnCurrentDomainUnhandledException;
Then declare your event catcher like private static void OnCurrentDomainUnhandledException(object sender, UnhandledExceptionEventArgs e)
and do what ever you want to do with that exception.
Upvotes: 0
Reputation: 64467
Are you referring to the behaviour where the debugger breaks on the exception? If so, this is configurable and off by default. If memory serves: Debug -> Exceptions... -> Common Language Runtime Exceptions, check "Thrown".
Upvotes: 1