System.Diagnostics.StackFrame Class

Assembly: Mscorlib.dll
Namespace: System.Diagnostics
Summary
Provides information about a StackFrame.
C# Syntax:
[Serializable]
public class StackFrame
See also:
System.Diagnostics Namespace

System.Diagnostics.StackFrame Member List:

Public Constructors
ctor #1 Overloaded:
.ctor()

Default constructor. This constructor is called by derived class constructors to initialize state in this type.
Initializes a new StackFrame object that corresponds to the active stack frame.
ctor #2 Overloaded:
.ctor(bool fNeedFileInfo)

Initializes a new StackFrame object that corresponds to the active stack frame, optionally capturing source information.
ctor #3 Overloaded:
.ctor(int skipFrames)

Initializes a new StackFrame object that corresponds to a frame above the active stack frame.
ctor #4 Overloaded:
.ctor(int skipFrames, bool fNeedFileInfo)

Initializes a new StackFrame object that corresponds to a frame above the active stack frame, optionally capturing source information.
ctor #5 Overloaded:
.ctor(string fileName, int lineNumber)

Initializes a new instance of the StackFrame object and constructs a dummy stack frame that only contains the given file name and line number.
ctor #6 Overloaded:
.ctor(string fileName, int lineNumber, int colNumber)

Initializes a new StackFrame object and constructs a dummy stack frame that only contains the given file name, line number, and column number.
Public Fields
OFFSET_UNKNOWN Defines the value returned from StackFrame.GetNativeOffset or StackFrame.GetILOffset when the native or Microsoft Intermediate Language (MSIL) offset is unknown. This field is constant.
Public Methods
Equals
(inherited from System.Object)
See base class member description: System.Object.Equals

Derived from System.Object, the primary base class for all objects.
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.
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.
GetFileName Gets the file name that contains the code that is executing. This information is typically extracted from the debugging symbols for the executable.
GetHashCode
(inherited from System.Object)
See base class member description: System.Object.GetHashCode

Derived from System.Object, the primary base class for all objects.
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 or not.
GetMethod Gets the method in which the frame is executing.
GetNativeOffset Gets the offset from the start of the native just-in-time (JIT)-compiled code for the method being executed.
GetType
(inherited from System.Object)
See base class member description: System.Object.GetType

Derived from System.Object, the primary base class for all objects.
ToString Overridden:
Builds a readable representation of the stack trace.
Protected Methods
Finalize
(inherited from System.Object)
See base class member description: System.Object.Finalize

Derived from System.Object, the primary base class for all objects.
MemberwiseClone
(inherited from System.Object)
See base class member description: System.Object.MemberwiseClone

Derived from System.Object, the primary base class for all objects.

Hierarchy:


System.Diagnostics.StackFrame Member Details

Overloaded ctor #1
Summary
Initializes a new StackFrame object that corresponds to the active stack frame.

Default constructor. This constructor is called by derived class constructors to initialize state in this type.
C# Syntax:
public StackFrame();

Return to top


Overloaded ctor #2
Summary
Initializes a new StackFrame object that corresponds to the active stack frame, optionally capturing source information.
C# Syntax:
public StackFrame(
   bool fNeedFileInfo
);
Parameters:

fNeedFileInfo

true to capture the file name, line number and column number; otherwise, false.

Return to top


Overloaded ctor #3
Summary
Initializes a new StackFrame object that corresponds to a frame above the active stack frame.
C# Syntax:
public StackFrame(
   int skipFrames
);
Parameters:

skipFrames

The number of frames up the stack to skip.

Return to top


Overloaded ctor #4
Summary
Initializes a new StackFrame object that corresponds to a frame above the active stack frame, optionally capturing source information.
C# Syntax:
public StackFrame(
   int skipFrames,
   bool fNeedFileInfo
);
Parameters:

skipFrames

The number of frames up the stack to skip.

fNeedFileInfo

true to capture the file name, line number and column number; otherwise, false.

Return to top


Overloaded ctor #5
Summary
Initializes a new instance of the StackFrame object and constructs a dummy stack frame that only contains the given file name and line number.
C# Syntax:
public StackFrame(
   string fileName,
   int lineNumber
);
Parameters:

fileName

The given file name.

lineNumber

The line number in the specified file.

Remarks
Use this constructor when you do not want to use the debugger's line mapping logic.

Return to top


Overloaded ctor #6
Summary
Initializes a new StackFrame object and constructs a dummy stack frame that only contains the given file name, line number, and column number.
C# Syntax:
public StackFrame(
   string fileName,
   int lineNumber,
   int colNumber
);
Parameters:

fileName

The given file name.

lineNumber

The line number in the specified file.

colNumber

The column number in the specified file.

Remarks
Use this constructor when you do not want to use the debugger's line mapping logic.

Return to top


Field: OFFSET_UNKNOWN
Summary
Defines the value returned from StackFrame.GetNativeOffset or StackFrame.GetILOffset when the native or Microsoft Intermediate Language (MSIL) offset is unknown. This field is constant.
C# Syntax:
public const int OFFSET_UNKNOWN;
Remarks
The value of this constant is a negative one (-1).

Return to top


Method: Equals(
   object obj
)
Inherited
See base class member description: System.Object.Equals
C# Syntax:
public virtual bool Equals(
   object obj
);

For more information on members inherited from System.Object click on the link above.

Return to top


Method: Finalize()
Inherited
See base class member description: System.Object.Finalize
C# Syntax:
~StackFrame();

For more information on members inherited from System.Object click on the link above.

Return to top


Method: GetFileColumnNumber()
Summary
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.
C# Syntax:
public virtual int GetFileColumnNumber();
Return Value:
The file column number.

-or-

Zero if the file column number cannot be determined.

Return to top


Method: GetFileLineNumber()
Summary
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.
C# Syntax:
public virtual int GetFileLineNumber();
Return Value:
The file line number.

-or-

Zero if the file line number cannot be determined.

Remarks
This method is not yet implemented.

Return to top


Method: GetFileName()
Summary
Gets the file name that contains the code that is executing. This information is typically extracted from the debugging symbols for the executable.
C# Syntax:
public virtual string GetFileName();
Return Value:
The file name.

-or-

null if the file name cannot be determined.

Remarks
This method is not yet implemented.

Return to top


Method: GetHashCode()
Inherited
See base class member description: System.Object.GetHashCode
C# Syntax:
public virtual int GetHashCode();

For more information on members inherited from System.Object click on the link above.

Return to top


Method: GetILOffset()
Summary
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 or not.
C# Syntax:
public virtual int GetILOffset();
Return Value:
The offset from the start of the MSIL code for the method that is executing.

Return to top


Method: GetMethod()
Summary
Gets the method in which the frame is executing.
C# Syntax:
public virtual MethodBase GetMethod();
Return Value:
The method in which the frame is executing.

Return to top


Method: GetNativeOffset()
Summary
Gets the offset from the start of the native just-in-time (JIT)-compiled code for the method being executed.
C# Syntax:
public virtual int GetNativeOffset();
Return Value:
The offset from the start of the JIT-compiled code for the method being executed.

Return to top


Method: GetType()
Inherited
See base class member description: System.Object.GetType
C# Syntax:
public Type GetType();

For more information on members inherited from System.Object click on the link above.

Return to top


Method: MemberwiseClone()
Inherited
See base class member description: System.Object.MemberwiseClone
C# Syntax:
protected object MemberwiseClone();

For more information on members inherited from System.Object click on the link above.

Return to top


Overridden Method: ToString()
Summary
Builds a readable representation of the stack trace.
C# Syntax:
public override string ToString();
Return Value:
Returns a readable representation.

Return to top


Top of page

Copyright (c) 2002 Microsoft Corporation. All rights reserved.