mscorlib(4.0.0.0) API with additions
System.Diagnostics.StackTrace Class Reference

Represents a stack trace, which is an ordered collection of one or more stack frames. More...

Public Member Functions

 StackTrace ()
 Initializes a new instance of the T:System.Diagnostics.StackTrace class from the caller's frame. More...
 
 StackTrace (bool fNeedFileInfo)
 Initializes a new instance of the T:System.Diagnostics.StackTrace class from the caller's frame, optionally capturing source information. More...
 
 StackTrace (int skipFrames)
 Initializes a new instance of the T:System.Diagnostics.StackTrace class from the caller's frame, skipping the specified number of frames. More...
 
 StackTrace (int skipFrames, bool fNeedFileInfo)
 Initializes a new instance of the T:System.Diagnostics.StackTrace class from the caller's frame, skipping the specified number of frames and optionally capturing source information. More...
 
 StackTrace (Exception e)
 Initializes a new instance of the T:System.Diagnostics.StackTrace class using the provided exception object. More...
 
 StackTrace (Exception e, bool fNeedFileInfo)
 Initializes a new instance of the T:System.Diagnostics.StackTrace class, using the provided exception object and optionally capturing source information. More...
 
 StackTrace (Exception e, int skipFrames)
 Initializes a new instance of the T:System.Diagnostics.StackTrace class using the provided exception object and skipping the specified number of frames. More...
 
 StackTrace (Exception e, int skipFrames, bool fNeedFileInfo)
 Initializes a new instance of the T:System.Diagnostics.StackTrace class using the provided exception object, skipping the specified number of frames and optionally capturing source information. More...
 
 StackTrace (StackFrame frame)
 Initializes a new instance of the T:System.Diagnostics.StackTrace class that contains a single frame. More...
 
 StackTrace (Thread targetThread, bool needFileInfo)
 Initializes a new instance of the T:System.Diagnostics.StackTrace class for a specific thread, optionally capturing source information. Do not use this constructor overload. More...
 
virtual StackFrame GetFrame (int index)
 Gets the specified stack frame. More...
 
virtual StackFrame [] GetFrames ()
 Returns a copy of all stack frames in the current stack trace. More...
 
override string ToString ()
 Builds a readable representation of the stack trace. More...
 

Public Attributes

const int METHODS_TO_SKIP = 0
 Defines the default for the number of methods to omit from the stack trace. This field is constant. More...
 
virtual int FrameCount => m_iNumOfFrames
 Gets the number of frames in the stack trace. More...
 

Detailed Description

Represents a stack trace, which is an ordered collection of one or more stack frames.

Definition at line 16 of file StackTrace.cs.

Constructor & Destructor Documentation

◆ StackTrace() [1/10]

System.Diagnostics.StackTrace.StackTrace ( )

Initializes a new instance of the T:System.Diagnostics.StackTrace class from the caller's frame.

Definition at line 39 of file StackTrace.cs.

◆ StackTrace() [2/10]

System.Diagnostics.StackTrace.StackTrace ( bool  fNeedFileInfo)

Initializes a new instance of the T:System.Diagnostics.StackTrace class from the caller's frame, optionally capturing source information.

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

Definition at line 49 of file StackTrace.cs.

◆ StackTrace() [3/10]

System.Diagnostics.StackTrace.StackTrace ( int  skipFrames)

Initializes a new instance of the T:System.Diagnostics.StackTrace class from the caller's frame, skipping the specified number of frames.

Parameters
skipFramesThe number of frames up the stack from which to start the trace.
Exceptions
T:System.ArgumentOutOfRangeExceptionThe skipFrames parameter is negative.

Definition at line 59 of file StackTrace.cs.

◆ StackTrace() [4/10]

System.Diagnostics.StackTrace.StackTrace ( int  skipFrames,
bool  fNeedFileInfo 
)

Initializes a new instance of the T:System.Diagnostics.StackTrace class from the caller's frame, skipping the specified number of frames and optionally capturing source information.

Parameters
skipFramesThe number of frames up the stack from which to start the trace.
fNeedFileInfotrue to capture the file name, line number, and column number; otherwise, false.
Exceptions
T:System.ArgumentOutOfRangeExceptionThe skipFrames parameter is negative.

Definition at line 75 of file StackTrace.cs.

◆ StackTrace() [5/10]

System.Diagnostics.StackTrace.StackTrace ( Exception  e)

Initializes a new instance of the T:System.Diagnostics.StackTrace class using the provided exception object.

Parameters
eThe exception object from which to construct the stack trace.
Exceptions
T:System.ArgumentNullExceptionThe parameter e is null.

Definition at line 89 of file StackTrace.cs.

◆ StackTrace() [6/10]

System.Diagnostics.StackTrace.StackTrace ( Exception  e,
bool  fNeedFileInfo 
)

Initializes a new instance of the T:System.Diagnostics.StackTrace class, using the provided exception object and optionally capturing source information.

Parameters
eThe exception object from which to construct the stack trace.
fNeedFileInfotrue to capture the file name, line number, and column number; otherwise, false.
Exceptions
T:System.ArgumentNullExceptionThe parameter e is null.

Definition at line 105 of file StackTrace.cs.

◆ StackTrace() [7/10]

System.Diagnostics.StackTrace.StackTrace ( Exception  e,
int  skipFrames 
)

Initializes a new instance of the T:System.Diagnostics.StackTrace class using the provided exception object and skipping the specified number of frames.

Parameters
eThe exception object from which to construct the stack trace.
skipFramesThe number of frames up the stack from which to start the trace.
Exceptions
T:System.ArgumentNullExceptionThe parameter e is null.
T:System.ArgumentOutOfRangeExceptionThe skipFrames parameter is negative.

Definition at line 121 of file StackTrace.cs.

◆ StackTrace() [8/10]

System.Diagnostics.StackTrace.StackTrace ( Exception  e,
int  skipFrames,
bool  fNeedFileInfo 
)

Initializes a new instance of the T:System.Diagnostics.StackTrace class using the provided exception object, skipping the specified number of frames and optionally capturing source information.

Parameters
eThe exception object from which to construct the stack trace.
skipFramesThe number of frames up the stack from which to start the trace.
fNeedFileInfotrue to capture the file name, line number, and column number; otherwise, false.
Exceptions
T:System.ArgumentNullExceptionThe parameter e is null.
T:System.ArgumentOutOfRangeExceptionThe skipFrames parameter is negative.

Definition at line 143 of file StackTrace.cs.

◆ StackTrace() [9/10]

System.Diagnostics.StackTrace.StackTrace ( StackFrame  frame)

Initializes a new instance of the T:System.Diagnostics.StackTrace class that contains a single frame.

Parameters
frameThe frame that the T:System.Diagnostics.StackTrace object should contain.

Definition at line 160 of file StackTrace.cs.

◆ StackTrace() [10/10]

System.Diagnostics.StackTrace.StackTrace ( Thread  targetThread,
bool  needFileInfo 
)

Initializes a new instance of the T:System.Diagnostics.StackTrace class for a specific thread, optionally capturing source information. Do not use this constructor overload.

Parameters
targetThreadThe thread whose stack trace is requested.
needFileInfotrue to capture the file name, line number, and column number; otherwise, false.
Exceptions
T:System.Threading.ThreadStateExceptionThe thread targetThread is not suspended.

Definition at line 174 of file StackTrace.cs.

Member Function Documentation

◆ GetFrame()

virtual StackFrame System.Diagnostics.StackTrace.GetFrame ( int  index)
virtual

Gets the specified stack frame.

Parameters
indexThe index of the stack frame requested.
Returns
The specified stack frame.

Definition at line 261 of file StackTrace.cs.

◆ GetFrames()

virtual StackFrame [] System.Diagnostics.StackTrace.GetFrames ( )
virtual

Returns a copy of all stack frames in the current stack trace.

Returns
An array of type T:System.Diagnostics.StackFrame representing the function calls in the stack trace.

Definition at line 273 of file StackTrace.cs.

◆ ToString()

override string System.Diagnostics.StackTrace.ToString ( )

Builds a readable representation of the stack trace.

Returns
A readable representation of the stack trace.

Definition at line 286 of file StackTrace.cs.

Member Data Documentation

◆ FrameCount

virtual int System.Diagnostics.StackTrace.FrameCount => m_iNumOfFrames

Gets the number of frames in the stack trace.

Returns
The number of frames in the stack trace.

Definition at line 36 of file StackTrace.cs.

◆ METHODS_TO_SKIP

const int System.Diagnostics.StackTrace.METHODS_TO_SKIP = 0

Defines the default for the number of methods to omit from the stack trace. This field is constant.

Definition at line 30 of file StackTrace.cs.


The documentation for this class was generated from the following file: