Bloody useful, this code. Especially when threads or timers are involved.
class Tracer
{
private Tracer() { }
public static void WriteTracedDebugLine(string message)
{
StackTrace stack = new StackTrace();
string caller = stack.GetFrame(2).GetMethod().Name;
string callee = stack.GetFrame(1).GetMethod().Name;
if(message != null && message.Length > 0)
Debug.WriteLine(message, caller + " -> " + callee);
else
Debug.WriteLine(caller + " -> " + callee);
}
}