DebuggerStepThrough Attribute in C#

Often when we debug, we unnecessarily step into (By Pressing F11) blocks we don’t require to debug. DebuggerStepThrough is the attribute which helps for this purpose.


As you see in the following example, the Person class has two methods such as Method1() and Method2().

To use the DebuggerStepThrough attribute we need to use the namespace System.Diagnostics.


Notice that, Method1 has the DebuggerStepThrough attribute. That means, when we debug the code, and Method1() debugger steps would be skipped. However the code would still continue to run. This behavior is similar to when we do a Step Over using the F10 key.


Hope this post is useful.

Thanks for reading. Like Method Of Tried in Facebook.