I know it was possible to use:
System.Diagnostics.StackTrace t = new System.Diagnostics.StackTrace();
but that seems to not work anymore, as it needs an Exception-Object.
Try: Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
A trace of the method calls is called a stack trace. The stack trace listing provides a way to follow the call stack to the line number in the method where the exception occurs. The StackTrace property returns the frames of the call stack that originate at the location where the exception was thrown.
Use the console. trace() method to get the stack trace from an error. The console. trace() method outputs the stack trace and shows the call path taken to reach the point at which the method was called.
Each thread has its own call stack, representing the calls made in that thread. To get a stack trace, use the methods GetStackTrace and GetContextStackTrace. A stack trace can be printed using OutputStackTrace and OutputContextStackTrace.
Try Environment.StackTrace. Just remember to be careful with what your logic afterwards is as stacks can change in unpredictable ways. Some discussion here: https://github.com/dotnet/corefx/issues/1420
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With