Gets a string representation of the frames on the call stack at the time the current exception was thrown.
Assembly: mscorlib (in mscorlib.dll)
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.