Environment::StackTrace Property
Gets current stack trace information.
Assembly: mscorlib (in mscorlib.dll)
Property Value
Type: System::StringA string containing stack trace information. This value can be String::Empty.
| Exception | Condition |
|---|---|
| ArgumentOutOfRangeException | The requested stack trace information is out of range. |
The StackTrace property lists method calls in reverse chronological order, that is, the most recent method call is described first, and one line of stack trace information is listed for each method call on the stack. However, the StackTrace property might not report as many method calls as expected due to code transformations that occur during optimization.
Note |
|---|
For a hierarchical view of the stack trace information by class, use the StackTrace class. |
The StackTrace property formats the stack trace information for each method call 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, MethodParms, FileName, and LineNumber, are replaced by actual values defined as follows:
The following example demonstrates the StackTrace property.
// Sample for the Environment::StackTrace property using namespace System; int main() { Console::WriteLine(); Console::WriteLine( "StackTrace: ' {0}'", Environment::StackTrace ); } /* This example produces the following results: StackTrace: ' at System::Environment::GetStackTrace(Exception e) at System::Environment::GetStackTrace(Exception e) at System::Environment::get_StackTrace() at Sample::Main()' */
- EnvironmentPermission
for full access to the resource protected by the permission. Associated enumeration: PermissionState::Unrestricted
Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows XP SP2 x64 Edition, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2
The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.
Note