Export (0) Print
Expand All
2 out of 4 rated this helpful - Rate this topic

DebuggerNonUserCodeAttribute Class

Note: This class is new in the .NET Framework version 2.0.

Identifies a type or member that is not part of the user code for an application.

Namespace: System.Diagnostics
Assembly: mscorlib (in mscorlib.dll)

[SerializableAttribute] 
[AttributeUsageAttribute(AttributeTargets.Class|AttributeTargets.Struct|AttributeTargets.Constructor|AttributeTargets.Method|AttributeTargets.Property, Inherited=false)] 
[ComVisibleAttribute(true)] 
public sealed class DebuggerNonUserCodeAttribute : Attribute
/** @attribute SerializableAttribute() */ 
/** @attribute AttributeUsageAttribute(AttributeTargets.Class|AttributeTargets.Struct|AttributeTargets.Constructor|AttributeTargets.Method|AttributeTargets.Property, Inherited=false) */ 
/** @attribute ComVisibleAttribute(true) */ 
public final class DebuggerNonUserCodeAttribute extends Attribute
SerializableAttribute 
AttributeUsageAttribute(AttributeTargets.Class|AttributeTargets.Struct|AttributeTargets.Constructor|AttributeTargets.Method|AttributeTargets.Property, Inherited=false) 
ComVisibleAttribute(true) 
public final class DebuggerNonUserCodeAttribute extends Attribute

Designer provided types and members that are not part of the code specifically created by the user can complicate the debugging experience. This attribute suppresses the display of these adjunct types and members in the debugger window and automatically steps through, rather than into, designer provided code. When the debugger encounters this attribute when stepping through user code, the user experience is to not see the designer provided code and to step to the next user-supplied code statement.

NoteNote

The common language runtime attaches no semantics to this attribute. It is provided for use by source code debuggers. For example, in Visual Studio 2005, the debugger does not display an element with this attribute in the debugger window, does not stop in a method with this attribute, and does not allow a breakpoint to be set in the method.

The debugger behavior when the DebuggerNonUserCodeAttribute is present is similar to using a combination of the DebuggerHiddenAttribute attribute, which hides the code from the debugger, and the DebuggerStepThroughAttribute attribute, which tells the debugger to step through, rather than into, the code it is applied to.

The following code example shows the use of this attribute in a Visual Basic project.

' Form overrides Dispose to clean up the component list.
<System.Diagnostics.DebuggerNonUserCode()> _
Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean)
    If disposing AndAlso components IsNot Nothing Then
        components.Dispose()
    End If
    MyBase.Dispose(disposing)
End Sub
System.Object
   System.Attribute
    System.Diagnostics.DebuggerNonUserCodeAttribute
Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

Windows 98, Windows 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile for Pocket PC, Windows Mobile for Smartphone, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see System Requirements.

.NET Framework

Supported in: 2.0

.NET Compact Framework

Supported in: 2.0
Did you find this helpful?
(1500 characters remaining)
Thank you for your feedback

Community Additions

ADD
Show:
© 2014 Microsoft. All rights reserved.