Why does VS2010 stop debugging when it hits certain exceptions, instead of breaking?
So I keep triggering a System.InvalidOperationException
some where in my code.
It's extremely difficult to debug.
Any time attach a debugger via VS2010 and run my code, when it gets to the System.In开发者_StackOverflow中文版validOperationException
, the debugger automatically detaches, instead of breaking.
I've even gone into the debug settings and set it explicitly to break when thrown.
I'm not sure if automatically detaching when an exception is thrown, thus defeating the purpose of debugging in the first place is a "feature" I need to disable.
Any help would be appreciated.
A shot in the dark, but check the "Just My Code" debugging setting and ensure it's disabled:
- Debug » Options and Settings... » uncheck "Enable Just My Code (Managed only)" » click OK
After disabling JMC, try debugging again with breaking on first chance exceptions enabled. From MSDN on first chance exceptions and JMC:
If you are debugging with Just My Code enabled, the behavior is slightly different. With Just My Code enabled, the debugger ignores first-chance common language runtime (CLR) exceptions that are thrown outside of My Code and do not pass through My Code. If the exception is completely unhandled, however, the debugger always breaks.
This description doesn't sound exactly like what you're seeing, but you should still try toggling the JMC setting.
精彩评论