Edit

Share via


AssemblyInfo.StackTrace Property

Definition

Gets the current stack-trace information.

public:
 property System::String ^ StackTrace { System::String ^ get(); };
public string StackTrace { get; }
member this.StackTrace : string
Public ReadOnly Property StackTrace As String

Property Value

A String containing the current stack-trace information. The return value can be Empty.

Exceptions

The requested stack-trace information is out of range.

Examples

This example uses the My.Application.Info.StackTrace property to display the stack trace of the application from the point at which the code executes.

MsgBox("Stack trace: " & My.Application.Info.StackTrace)

Remarks

The My.Application.Info.StackTrace property lists method calls in reverse chronological order - that is, it describes the most recent method call first, and it lists each method call on the stack on a separate line. However, the My.Application.Info.StackTrace property might not report as many method calls as expected, due to code transformations that occur during optimization.

Typically, the stack-trace information is used for debugging applications.

The stack-trace information for each method call is formatted as follows:

"at FullClassName.MethodName(MethodParams) in FileName:line LineNumber "

The literal "at" is preceded by three spaces, and the literals "in" and ":line" are omitted if debug symbols are not available. The placeholders FullClassName, MethodName, MethodParams, FileName, and LineNumber are replaced by actual values, defined as follows:

Part Description
FullClassName The full name of the class, including the namespace.
MethodName The name of the method.
MethodParams The list of parameter type/name pairs. Each pair is separated by a comma (,). This information is omitted if MethodName takes zero parameters.
FileName The name of the source file where the MethodName method is declared. This information is omitted if debug symbols are not available.
LineNumber The number of the line in FileName that contains the source code from MethodName for the instruction that is on the call stack. This information is omitted if debug symbols are not available.

The My.Applicaiton.Info.StackTrace property provides functionality similar to the StackTrace property.

Availability by Project Type

Project type Available
Windows Forms Application Yes
Class Library Yes
Console Application Yes
Windows Forms Control Library Yes
Web Control Library No
Windows Service Yes
Web Site No

Applies to

See also