How to get the current Stack Trace without having a exception?

To print the current Stack Trace without having a exception you can use the StackTrace class located in System.Diagnostics Namespace

Sample C#

System.Diagnostics.StackTrace stackTrace = new System.Diagnostics.StackTrace();

Sample VB.NET

Dim stackTrace As New System.Diagnostics.StackTrace()

for more informations take a look at the MSDN: StackTrace Class, System.Diagnostics Namespace

2 thoughts on “How to get the current Stack Trace without having a exception?

Leave a Reply