StackFrame Class

Microsoft Silverlight will reach end of support after October 2021. Learn more.

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

Inheritance Hierarchy

System.Object
  System.Diagnostics.StackFrame

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

Syntax

'Declaration
<ComVisibleAttribute(True)> _
Public Class StackFrame
[ComVisibleAttribute(true)]
public class StackFrame

The StackFrame type exposes the following members.

Constructors

  Name Description
Public methodSupported by Silverlight for Windows PhoneSupported by Xbox 360 StackFrame() Initializes a new instance of the StackFrame class.
Public methodSupported by Silverlight for Windows PhoneSupported by Xbox 360 StackFrame(Boolean) Security Critical. Initializes a new instance of the StackFrame class, and optionally captures source information.
Public methodSupported by Silverlight for Windows PhoneSupported by Xbox 360 StackFrame(Int32) Initializes a new instance of the StackFrame class that corresponds to a frame above the current stack frame.
Public methodSupported by Silverlight for Windows PhoneSupported by Xbox 360 StackFrame(Int32, Boolean) Security Critical. Initializes a new instance of the StackFrame class that corresponds to a frame above the current stack frame, and optionally captures source information.
Public methodSupported by Silverlight for Windows PhoneSupported by Xbox 360 StackFrame(String, Int32) Initializes a new instance of the StackFrame class that contains only the specified file name and line number.
Public methodSupported by Silverlight for Windows PhoneSupported by Xbox 360 StackFrame(String, Int32, Int32) Initializes a new instance of the StackFrame class that contains only the specified file name, line number, and column number.

Top

Methods

  Name Description
Public methodSupported by Silverlight for Windows PhoneSupported by Xbox 360 Equals(Object) Determines whether the specified Object is equal to the current Object. (Inherited from Object.)
Protected methodSupported by Silverlight for Windows PhoneSupported by Xbox 360 Finalize Allows an object to try to free resources and perform other cleanup operations before the Object is reclaimed by garbage collection. (Inherited from Object.)
Public methodSupported by Silverlight for Windows PhoneSupported by Xbox 360 GetFileColumnNumber 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.
Public methodSupported by Silverlight for Windows PhoneSupported by Xbox 360 GetFileLineNumber 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.
Public methodSupported by Silverlight for Windows PhoneSupported by Xbox 360 GetFileName Security Critical. Gets the file name that contains the code that is executing. This information is typically extracted from the debugging symbols for the executable.
Public methodSupported by Silverlight for Windows PhoneSupported by Xbox 360 GetHashCode Serves as a hash function for a particular type. (Inherited from Object.)
Public methodSupported by Silverlight for Windows PhoneSupported by Xbox 360 GetILOffset 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 the just-in-time (JIT) compiler is generating debugging code. The generation of this debugging information is controlled by the DebuggableAttribute attribute.
Public methodSupported by Silverlight for Windows PhoneSupported by Xbox 360 GetMethod Gets the method in which the frame is executing.
Public methodSupported by Silverlight for Windows PhoneSupported by Xbox 360 GetNativeOffset 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.
Public methodSupported by Silverlight for Windows PhoneSupported by Xbox 360 GetType Gets the Type of the current instance. (Inherited from Object.)
Protected methodSupported by Silverlight for Windows PhoneSupported by Xbox 360 MemberwiseClone Creates a shallow copy of the current Object. (Inherited from Object.)
Public methodSupported by Silverlight for Windows PhoneSupported by Xbox 360 ToString Builds a readable representation of the stack frame. (Overrides Object.ToString().)

Top

Fields

  Name Description
Public fieldStatic memberSupported by Silverlight for Windows PhoneSupported by Xbox 360 OFFSET_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.

Top

Remarks

A StackFrame object is created and pushed on the call stack for every function call that is 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, but release builds do not. The debug symbols contain most of the file, method name, line number, and column information that is used in constructing StackFrame objects.

Platform Notes

Silverlight for Windows Phone Silverlight for Windows Phone

 StackFrame is not supported in Silverlight for Windows Phone.

Version Information

Silverlight

Supported in: 5, 4, 3

Silverlight for Windows Phone

Supported in: Windows Phone OS 7.1, Windows Phone OS 7.0

XNA Framework

Supported in: Xbox 360, Windows Phone OS 7.0

Platforms

For a list of the operating systems and browsers that are supported by Silverlight, see Supported Operating Systems and Browsers.

Thread Safety

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