Possible Duplicate:
How to print the current Stack Trace in .NET without any exception?
When an exception is thrown, its text contains the stack trace. Can I somehow obtain the stack trace text(including file and line) without exceptions?
public void f()
{
//blah
string stacktrace = ???;
//blah
}
Environment.StackTrace or System.Diagnostics.StackTrace if you need a more convienient (i.e. not string) representation