oscilatingcretin
oscilatingcretin

Reputation: 10919

Override DebuggerStepThrough attribute without removing it

First, there is this question:

Can I break in a method marked with DebuggerStepThrough attribute?

While it may be a dupe, it's over 4 years old, has one question which doesn't appear to be accurate, and is for a different version of VS than what I'm using which is 2013.

Is it possible to mark a method with DebuggerStepThrough but also be able to step into it either by setting a breakpoint or using some other keyboard shortcut? I do not want to have to remove the attribute.

Upvotes: 5

Views: 1239

Answers (1)

James Joyce
James Joyce

Reputation: 1774

Using VS2017; I have marked my class with [DebuggerStepThrough], so the debugger steps over all the code in the class.

However, I recently added a new method, and wanted to focus just on this one. The debugger will ignore any breakpoints because of the "DebuggerStepThrough" attribute on the class.

To get the debugger to stop there were 2 options;

  1. Take off the attribute (of course)
  2. Turn off "Enable just my code" (Tools -> Options -> Debugging -> General -> Enable Just My Code).
  • This causes the debugger to break if there are breakpoints set - but otherwise steps over the code!

It would be nice if I could mark a single method within the class with a [DebuggerStepThrough(false)]!!! But this method works without touching the original code...

Upvotes: 3

Related Questions