Getting a stacktrace

I'm trying to get a stacktrace and have come across two means to do so. One is using System.Diagnostics.StackTrace, and the other is using Environment.StackTrace. Now the one it Diagnostics seems to be a more fleshed out object (environment.StackTrace is just a string) with all sorts of nice bells and whistles, however the one downside I'm finding with it is that if I do StackTrace.ToString(), it doesn't have any of the path and line number information.

IE: something like at Application.Main() in d:\filepath\Program.cs:line 42

Does anyone know if it is possible to get System.Diagnostics.StackTrace to output that?

by MacrosInHisSleep via /r/csharp

Leave a Reply