StackFrame Class

 

Provides information about a StackFrame, which represents a function call on the call stack for the current thread.

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

System.Object
  System.Diagnostics.StackFrame

[<SerializableAttribute>]
[<ComVisibleAttribute(true)>]
[<SecurityPermissionAttribute(SecurityAction.InheritanceDemand,
    UnmanagedCode = true)>]
type StackFrame = class end

NameDescription
System_CAPS_pubmethodStackFrame()

Initializes a new instance of the StackFrame class.

System_CAPS_pubmethodStackFrame(Boolean)

Initializes a new instance of the StackFrame class, optionally capturing source information.

System_CAPS_pubmethodStackFrame(Int32)

Initializes a new instance of the StackFrame class that corresponds to a frame above the current stack frame.

System_CAPS_pubmethodStackFrame(Int32, Boolean)

Initializes a new instance of the StackFrame class that corresponds to a frame above the current stack frame, optionally capturing source information.

System_CAPS_pubmethodStackFrame(String, Int32)

Initializes a new instance of the StackFrame class that contains only the given file name and line number.

System_CAPS_pubmethodStackFrame(String, Int32, Int32)

Initializes a new instance of the StackFrame class that contains only the given file name, line number, and column number.

NameDescription
System_CAPS_pubmethodEquals(Object)

Determines whether the specified object is equal to the current object.(Inherited from Object.)

System_CAPS_protmethodFinalize()

Allows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection.(Inherited from Object.)

System_CAPS_pubmethodGetFileColumnNumber()

Gets the column number in the file that contains the code that is executing. This information is typically extracted from the debugging symbols for the executable.

System_CAPS_pubmethodGetFileLineNumber()

Gets the line number in the file that contains the code that is executing. This information is typically extracted from the debugging symbols for the executable.

System_CAPS_pubmethodGetFileName()

Gets the file name that contains the code that is executing. This information is typically extracted from the debugging symbols for the executable.

System_CAPS_pubmethodGetHashCode()

Serves as the default hash function. (Inherited from Object.)

System_CAPS_pubmethodGetILOffset()

Gets the offset from the start of the Microsoft intermediate language (MSIL) code for the method that is executing. This offset might be an approximation depending on whether or not the just-in-time (JIT) compiler is generating debugging code. The generation of this debugging information is controlled by the DebuggableAttribute.

System_CAPS_pubmethodGetMethod()

Gets the method in which the frame is executing.

System_CAPS_pubmethodGetNativeOffset()

Gets the offset from the start of the native just-in-time (JIT)-compiled code for the method that is being executed. The generation of this debugging information is controlled by the DebuggableAttribute class.

System_CAPS_pubmethodGetType()

Gets the Type of the current instance.(Inherited from Object.)

System_CAPS_protmethodMemberwiseClone()

Creates a shallow copy of the current Object.(Inherited from Object.)

System_CAPS_pubmethodToString()

Builds a readable representation of the stack trace.(Overrides Object.ToString().)

NameDescription
System_CAPS_pubfieldSystem_CAPS_staticOFFSET_UNKNOWN

Defines the value that is returned from the GetNativeOffset or GetILOffset method when the native or Microsoft intermediate language (MSIL) offset is unknown. This field is constant.

A StackFrame is created and pushed on the call stack for every function call made during the execution of a thread. The stack frame always includes MethodBase information, and optionally includes file name, line number, and column number information.

StackFrame information will be most informative with Debug build configurations. By default, Debug builds include debug symbols, while Release builds do not. The debug symbols contain most of the file, method name, line number, and column information used in constructing StackFrame objects.

The following example demonstrates the use of the StackFrame class to provide the stack frame information for a stack trace.

No code example is currently available or this language may not be supported.

The following example demonstrates the use of the members of the StackFrame class.

No code example is currently available or this language may not be supported.

InheritanceDemand

for the ability of inheritors to access unmanaged code. Associated enumeration: SecurityPermissionFlag.UnmanagedCode. This class cannot be inherited by partially trusted code.

Universal Windows Platform
Available since 10
.NET Framework
Available since 1.1
Silverlight
Available since 2.0
Windows Phone Silverlight
Available since 7.0

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

Return to top
Show: