Jaded
Jaded

Reputation: 21

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 enter these methods? (outside of setting breakpoints after each and every one)

Upvotes: 2

Views: 125

Answers (2)

JaredPar
JaredPar

Reputation: 754735

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

Upvotes: 2

Trevor Abell
Trevor Abell

Reputation: 752

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.

Upvotes: 0

Related Questions