0

I have an exception handling attribute for the controller that writes error logs for every exception that comes in the program. I have .pdb file deployed on the server and have below code to written for the line numbers:

// Get stack trace for the exception with source file information
var st = new StackTrace(ex, true);
// Get the top stack frame
var frame = st.GetFrame(0);
// Get the line number from the stack frame
var line = frame.GetFileLineNumber();

Still I get line number as 0.

I have two questions on this:

  1. Shouldn't the line numbers get automatically written if I keep the .pdb file on the server?
  2. Why am I getting them as 0 in the above code?

I referred to msdn, question.

Appreciate your reply.

Community
  • 1
  • 1
Mustafa
  • 202
  • 3
  • 14

0 Answers0