System.Diagnostics.DebuggerStepThroughAttribute Class

Instructs the debugger to step through the code instead of stepping into the code. This class cannot be inherited.

See Also: DebuggerStepThroughAttribute Members


[System.AttributeUsage(System.AttributeTargets.Class | System.AttributeTargets.Struct | System.AttributeTargets.Constructor | System.AttributeTargets.Method | System.AttributeTargets.All, Inherited=false)]
public sealed class DebuggerStepThroughAttribute : Attribute


This attribute is provided for use by source code debuggers; the common language runtime is not affected by it. For example, the Visual Studio debugger does not stop in a method that is marked with this attribute even if a breakpoint is set in the method. The following code shows how the Visual Basic compiler uses the attribute.


<System.Diagnostics.DebuggerStepThrough()> _
    Private Sub InitializeComponent()
        components = New System.ComponentModel.Container()
        Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font
        Me.Text = "Form1"
    End Sub

This attribute avoids having to step into compiler-provided code and only steps into developer-provided code. For example, if you are stepping through code by using the F11 (Step Into) key, the attribute will cause the step to behave like an F10 (Step Over) key for compiler-provided code. The method won’t be stepped into, but it will be executed.

For more information about using attributes, see Extending Metadata Using Attributes.


Namespace: System.Diagnostics
Assembly: mscorlib (in mscorlib.dll)
Assembly Versions: 1.0.5000.0,,