简体   繁体   中英

Exceptions ignored

Problem

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.

Questions

  • Is there any possible reason for this behavior?
  • Is there a way to see exactly where the exception is gone? I tried looking at the call stack, stepping into dissassembled code, catching the exception at other levels, ...

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM