Programmatically get C# Stack Trace [duplicate] May 25, 2023 by Tarik Environment.StackTrace or System.Diagnostics.StackTrace if you need a more convenient (i.e. not string) representation