Hi,
I am written (ASP.NET) below the code for getting exception Line number
string errorLine;
StackTrace st = new StackTrace(0, true);
StackFrame sf = new StackFrame();
sf = st.GetFrame(0);
errorLine = sf.GetFileLineNumber().ToString();
But, I am not getting exactly exception line no. different line no is came
How to get Exception Error Exactly Line No ?
1 Answer
Know the answer? Post it. Somebody with the same question will find it here.


Upendra Pratap ShahiRank #329 · 7.5K reputationPosted Sep 14, 2015, 2:00 AM EDT
StackTrace st = new StackTrace(0, true);
StackFrame sf = new StackFrame();
sf = st.GetFrame(1);
errorLine = sf.GetFileLineNumber().ToString();