Click to Rate and Give Feedback
This page is specific to
Microsoft Visual Studio 2008/.NET Framework 3.5

Other versions are also available for the following:
.NET Framework Class Library
DebuggerNonUserCodeAttribute Class

Updated: November 2007

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

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

Visual Basic (Declaration)
<SerializableAttribute> _
<AttributeUsageAttribute(AttributeTargets.Class Or AttributeTargets.Struct Or AttributeTargets.Constructor Or AttributeTargets.Method Or AttributeTargets.Property, Inherited := False)> _
<ComVisibleAttribute(True)> _
Public NotInheritable Class DebuggerNonUserCodeAttribute _
    Inherits Attribute
Visual Basic (Usage)
Dim instance As DebuggerNonUserCodeAttribute
C#
[SerializableAttribute]
[AttributeUsageAttribute(AttributeTargets.Class|AttributeTargets.Struct|AttributeTargets.Constructor|AttributeTargets.Method|AttributeTargets.Property, Inherited = false)]
[ComVisibleAttribute(true)]
public sealed class DebuggerNonUserCodeAttribute : Attribute
Visual C++
[SerializableAttribute]
[AttributeUsageAttribute(AttributeTargets::Class|AttributeTargets::Struct|AttributeTargets::Constructor|AttributeTargets::Method|AttributeTargets::Property, Inherited = false)]
[ComVisibleAttribute(true)]
public ref class DebuggerNonUserCodeAttribute sealed : public Attribute
J#
/** @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
JScript
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.

Note:

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 Vista, Windows XP SP2, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP Starter Edition, Windows Server 2003, Windows Server 2000 SP4, Windows Millennium Edition, Windows 98, Windows CE, Windows Mobile for Smartphone, Windows Mobile for Pocket PC, Xbox 360

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

.NET Framework

Supported in: 3.5, 3.0, 2.0

.NET Compact Framework

Supported in: 3.5, 2.0

XNA Framework

Supported in: 2.0, 1.0
Tags What's this?: Add a tag
Community Content   What is Community Content?
Add new content RSS  Annotations
Processing
© 2008 Microsoft Corporation. All rights reserved. Terms of Use  |  Trademarks  |  Privacy Statement
Page view tracker