[Z]VS Debugging : Just My Code
The debugger has a new feature this time around called 'Just my code'. This is a new-for-Whidbey managed debugging feature.
Philosophy of Just my code:
The basic idea is that when you debug an application, you want to debug the code in the application, and not all the code that is in the Framework. Specifics:
- If you step into some non-user code (say the Framework), and that non-user code invokes your callback, you want to step into the callback, not step into the Framework
- If you step out of your code, you don't want to step into all that glue code, you want to break on your next event handler.
- If an exception is thrown and caught in someone else's code. You don't care.
- If your code failed to catch an exception, then you don't want to let it get swallowed by some big exception filter that a bad person has installed.
- Sometimes you want to break when an exception is thrown, but not every exception. You only care when your code throws the exception.
What does the debugger consider 'your code'?
- If the code is compiled optimized, it is not your code
- If you don't have symbols, it is not your code
When we were first coming up with this feature, I was thinking that this feature would be helpful to everyone. After all, everyone at least occasionally has the experience where code written by someone else gets in the way of debugging a problem in your code. However, after playing with the feature for a while, I have changed by mind. It’s a great feature if you want a simplified debugging experience. However, that isn't me. If you are a hard core dev, do yourself a favor and turn the feature off (Tools->Options->Debugging->General->Just My Code).
Also, one technical note for those who like the feature – if exceptions pass out of user code and are swallowed by certain parts of the Runtime (not the framework), the debugger will not be given a chance to break on the exception. The CLR is working to address this problem, but it is a difficult problem to solve. In Beta 1, one such location is the reflection engine.