I have a small logging method that I don't want to step through in normal debugging sessions in Visual Studio. I thought that there was an attribute to mark methods in a way that the debugger would automatically skip over them, but I can't find it in MSDN, and my googling hasn't turned up anything useful. Am I misremembering things? Is there an attribute that does this?
Asked
Active
Viewed 1,052 times
1
-
1Can you not just hit F10 instead of F11? – Moo-Juice Nov 21 '13 at 16:55
-
1http://msdn.microsoft.com/en-us/library/system.diagnostics.debuggerstepthroughattribute.aspx – JimmiTh Nov 21 '13 at 16:57
-
@JimmiTh, you should put that as an answer :) – Moo-Juice Nov 21 '13 at 16:57
-
Felt rather short for an answer - didn't feel like expanding on it. Besides, the "Related" list now shows a duplicate right at the top of the list. :-) – JimmiTh Nov 21 '13 at 17:14
-
I guess we have different "related" lists? "VSIX extension for VS2012 not running when debugging" is mine. – Reacher Gilt Nov 21 '13 at 17:25
-
Possible duplicate of [C# - Attribute to Skip over a Method while Stepping in Debug Mode](https://stackoverflow.com/questions/445276/c-sharp-attribute-to-skip-over-a-method-while-stepping-in-debug-mode) – relatively_random Sep 19 '17 at 06:59
1 Answers
9
There is an attribute you can use called DebuggerStepThrough (MSDN):
using System.Diagnostics
...
[DebuggerStepThrough]
public void MyMethod() {
...

Fenton
- 241,084
- 71
- 387
- 401
-
That's the one. Thank you! StackOverflow says "You can accept an answer in 5 minutes". – Reacher Gilt Nov 21 '13 at 17:03