VS 2010 Flag a Method to not be stepped into on debugging
I have a program that has several small methods (such as printing a line to the console for tracing, getter queries, etc).
Is there a way to flag these so when I'm stepping through debugging I don't ente开发者_运维知识库r these methods? (outside of setting breakpoints after each and every one)
You can avoid stepping into the method with the following combination
- Annotate the method with
[DebuggerNonUserCode]
- Ensure Just My Code Debugging is enabled.
The second is default for most Visual Studio profiles. You can verify though by doing the following
- Tools -> Options
- Navigate to Debugger
- Ensure "Enable Just My Code" is checked
You can use F10 or the 'step over' button on the debug toolbox to step-over methods while you're debugging. This will prevent you from entering these methods unless an exception is thrown or you have a breakpoint inside of them.
精彩评论