Last Updated: December 26, 2018
·
1.103K
· ChrisMissal

Skip Extension Methods when Debugging

Your projects might have a few extension methods that aren't worth stepping through line by line. If you're navigating a call stack with F11, you might be unexpectedly taken away to another file containing extension methods that are there for convenience, not for logical reasons.

Consider the following (contrived) extension method:

[DebuggerStepThrough]
public static string Important(this string self)
{
    return self + "!";
}

With the added [DebuggerStepThrough] attribute, you will no longer navigate to that method when stepping through your code with F11.

For more details: http://msdn.microsoft.com/en-us/library/system.diagnostics.debuggerstepthroughattribute.aspx