Reputation: 57
I handled the same exception in two programs, but I got the different results. I don't know why.
the first result is the one the program unable to caught
Scapshot1: www.freeimagehosting.net/uploads/e2b37433a3.png
and the second is the one the program succeed to caught
Scapshot2: www.freeimagehosting.net/uploads/6ab7564999.png
Why I got such a different?
Upvotes: 0
Views: 148
Reputation: 941327
You cannot change Application.UnhandledExceptionMode after Application.Run() was called, so clearly that's not the one that's going to catch the exception.
Which leaves AppDomain.UnhandledException. Yes, the debugger will break on the exception before that event is raised. Nice feature, allows you to debug the exception reason. Just press F5 to continue execution to trigger the event handler. There's no evidence of you using the debugger in the 2nd screen shot, looks like you started it with Ctrl+F5.
Upvotes: 1
Reputation: 239646
The behaviour of the debugger in the face of exceptions can vary wildly.
Exception Handling (Debugging)
Upvotes: 1
Reputation: 106
I am not sure if I understand, it looks like it's the same erro but
please provide more information
Upvotes: 1
Reputation: 117220
From what I can see, in #1 you are running in the debugger. In #2 you are not.
In fact, I will assume the exception is exactly the same, as the message is the same. There is no difference, IOW.
Upvotes: 3
Reputation: 1500145
Well, you haven't really provided much context. Things to check:
Upvotes: 3