Click here to Skip to main content
15,881,812 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Hello all,

My problem is that I cant get the linenumber of the frames in a stacktrace class from my website and log them to DB in my Global.asax file. The variable LineNumber is always zero (0).
I have checked that I have a PDB available in the applications bin folder.
So what do I have to do for getting the linenumbers? Is there something I need to write into my web.config - or to mention in project options or...?

Thanks in advance.
Michael

What I have tried:

C#
protected void Application_Error(object sender, EventArgs e)
{
    Exception exc = Server.GetLastError();
    StackTrace st = new StackTrace(exc, true);
    foreach (StackFrame frame in st.GetFrames())
    {
        int LineNumber = frame.GetFileLineNumber();
    }
    Server.ClearError();
}
Posted
Updated 9-Nov-21 6:14am
v2
Comments
[no name] 9-Nov-21 12:13pm    
https://newbedev.com/display-lines-number-in-stack-trace-for-net-assembly-in-release-mode

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900