using System.Diagnostics; static void Main(string[] args) { ReportError(); ReportError(); ReportError(); ReportError(); Console.ReadLine(); } private static void ReportError() { StackFrame callStack = new StackFrame(1, true); Console.WriteLine(callStack.GetFileLineNumber()); }