Reputation: 157
When our application throws an exception nothing happens.
The application react like an empty try catch is catching the exception somewhere at an higher level and the exception is ignored....
When simply throwing an exception like this throw new Exception("BOOM");
what can catch and ignore the exception???
I cant find any empty try-catch in my code or an higher level try-catch, where the exception is going??
I'm throwing the exception in a DragDrop event handler.
Upvotes: 2
Views: 147
Reputation: 941218
the exception is thrown in a DragDrop event
That was essential information, it would have been obvious if you had posted a snippet. Drag and drop event handlers are special. Any exception raised in them is swallowed without any diagnostic. The probable philosophy behind that is that they are likely to fail because they handle data that is produced by another program. And that a buggy program that produces bad data like that should not be allowed to crash yours.
If you need to debug your code then use Debug + Exceptions, tick the Thrown checkbox for CLR exceptions. The debugger will now stop when the exception is thrown.
If you want the user to know about any exceptions then you'll need to use try/catch to catch the exception before it is swallowed. With the slight risk that any bugs in another program become yours to explain.
Upvotes: 1