I am using C# having come from a Java background - I have an exception but it does not tell me the line number - Just the method name.
Is that usual?? Is it down to
The StackTrace property of the Exception class contains line numbers, at least if the debug information (pdb file) is available:
using System;
class Program {
public static void Main() {
try {
throw new Exception("test");
} catch (Exception e) {
Console.WriteLine(e.StackTrace);
}
}
}
will give the following output with the pdb file:
at Program.Main() in X:\code\test\test\Program.cs:line 6
and this without:
at Program.Main()