Share via


Exception.StackTrace Property

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

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

Syntax

public virtual string StackTrace { get; }

Property Value

A string that describes the contents of the call stack at the time when the current exception was thrown, starting with the most recent method call.

Remarks

The execution stack keeps track of all the methods that are executing at a particular point in time. A trace of these method calls is called a stack trace. You can use the stack trace listing to follow the call sequence to the line number in the method where a specific exception occurred.

Note that the StackTrace property may not report as many method calls as you might expect, because of code transformations (such as inlining) that occur during optimization.

Version Information

Available in the .NET Micro Framework versions 2.0, 2.5, 3.0, 4.0, 4.1, and 4.2.

See Also

Reference

Exception Class
Exception Members
System Namespace