 <p>If you want the file and line numbers, you do not need to parse the StackTrace string. You can use System.Diagnostics.StackTrace to create a stack trace from an exception, with this you can enumerate the stack frames and get the filename, line number and column that the exception was raised. Here is a quick and dirty example of how to do this. No error checking included. For this to work a PDB needs to exist with the debug symbols, this is created by default with debug build.</p> <pre><code>using System; using System.Diagnostics; namespace ConsoleApplication1 { class Program { static void Main(string[] args) { try { TestFunction(); } catch (Exception ex) { StackTrace st = new StackTrace(ex, true); StackFrame[] frames = st.GetFrames(); // Iterate over the frames extracting the information you need foreach (StackFrame frame in frames) { Console.WriteLine("{0}:{1}({2},{3})", frame.GetFileName(), frame.GetMethod().Name, frame.GetFileLineNumber(), frame.GetFileColumnNumber()); } } Console.ReadKey(); } static void TestFunction() { throw new InvalidOperationException(); } } } </code></pre> <p>The output from the above code looks like this</p> <pre> D:\Source\NGTests\ConsoleApplication1\Program.cs:TestFunction(30,7) D:\Source\NGTests\ConsoleApplication1\Program.cs:Main(11,9) </pre>