Exception.StackTrace Property

July 28, 2014

Gets a string representation of the frames on the call stack at the time the current exception was thrown.

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

'Declaration
Public Overridable ReadOnly Property StackTrace As String

Property Value

Type: System.String
A string that describes the contents of the call stack, with the most recent method call appearing first.

The execution stack keeps track of all the methods that are in execution at a given instant. A trace of the method calls is called a stack trace. The stack trace listing provides a means to follow the call sequence to the line number in the method where the exception occurs.

StackTrace may not report as many method calls as expected, due to code transformations, such as inlining, that occur during optimization.

Notes to Inheritors

The StackTrace property is overridden in classes that require control over the stack trace content or format.

By default, the stack trace is captured immediately before an exception object is thrown.

Windows Phone OS

Supported in: 8.1, 8.0, 7.1, 7.0

Windows Phone

Show:
© 2014 Microsoft