Freigeben über


StackTrace.GetFrames Method

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

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

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

Syntax

'Declaration
<ComVisibleAttribute(False)> _
Public Overridable Function GetFrames As StackFrame()
[ComVisibleAttribute(false)]
public virtual StackFrame[] GetFrames()

Return Value

Type: array<System.Diagnostics.StackFrame[]
An array that represents the function calls in the stack trace.

Remarks

Use the returned StackFrame array to enumerate and examine function calls in the StackTrace. The length of the returned array is equal to the FrameCount property value.

The StackFrame array elements are in reverse chronological order. The StackFrame at array index 0 represents the most recent function call in the stack trace and the last frame pushed onto the call stack. The StackFrame at array index FrameCount minus 1 represents the oldest function call in the stack trace and the first frame pushed onto the call stack.

Use the GetFrames method to obtain all stack frames in a stack trace. Use the GetFrame method to obtain a specific stack frame in a stack trace. The StackFrame indexes are ordered alike by the two methods. For example, the StackFrame at index 0 in the array returned by GetFrames is equivalent to the StackFrame returned by GetFrame with an input index of 0.

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.