Tech Off Thread

14 posts

Getting line number in Exception for ASP.NET

Back to Forum: Tech Off
  • JParrish

    Hoping someone may have overcome this before.

    I use the enterprise library exception handling block to email myself any errors that occur within my ASP.NET application. At one time, I was getting the line numbers of the exceptions. I realize the performance hit but it is ok while I am testing deployment in new environments. Lately I have not been able to get the line numbers any more which makes the error too ambiguous. I have my build configurations to active debug, and in the web.config compilation debug is true.

    For libraries I call from the web app, I have the pdb files deployed into the bin folder. Does anyone know anything more I can check/do to try and get the exception to include the line number? I am using fixed name single page assemblies if that matters.

  • ScanIAm

    JParrish wrote:
    

    Hoping someone may have overcome this before.

    I use the enterprise library exception handling block to email myself any errors that occur within my ASP.NET application. At one time, I was getting the line numbers of the exceptions. I realize the performance hit but it is ok while I am testing deployment in new environments. Lately I have not been able to get the line numbers any more which makes the error too ambiguous. I have my build configurations to active debug, and in the web.config compilation debug is true.

    For libraries I call from the web app, I have the pdb files deployed into the bin folder. Does anyone know anything more I can check/do to try and get the exception to include the line number? I am using fixed name single page assemblies if that matters.



    I'm not familiar with how to set this up for web remote deployments, but if you have control over what shows up in the email, then look at

    System.Exception.StackTrace

    it's part of the exception object, and it should hold the stack trace and line numbers (if they are available).

  • JParrish

    ScanIAm wrote:
    
    I'm not familiar with how to set this up for web remote deployments, but if you have control over what shows up in the email, then look at

    System.Exception.StackTrace

    it's part of the exception object, and it should hold the stack trace and line numbers (if they are available).


    Thanks.. but yes the template formatting the email includes the full stack trace, which would contain the line number. That is the part I don't understand, it should show me the line number since it was compiled for debug and symbols for other libraries are there. Expressionless

  • Sven Groot

    Is debugging enabled in the web.config? If not it might not load the symbols.

  • JParrish

    Sven Groot wrote:
    Is debugging enabled in the web.config? If not it might not load the symbols.


    Sven.. I have the debug attribute set to true for the compilation section. Is there somewhere else I should look? Thanks

  • stevo_

    Tried a rebuild? I've noticed sometimes the pdb is ignored only for a rebuild to make it start working again.

  • littleguru

    stevo_ wrote:
    Tried a rebuild? I've noticed sometimes the pdb is ignored only for a rebuild to make it start working again.


    Clean solution, rebuild is very useful in some cases...

  • DickB

    Checked whether the .pdb files are actually in there?

  • jh71283

    DickB said:
    Checked whether the .pdb files are actually in there?
    nearly a year ago dude....


    EDIT


    over a year ago dude...

  • Zambonilli

    jh71283 said:
    DickB said:
    *snip*
    nearly a year ago dude....


    EDIT


    over a year ago dude...
    If you use the visual studio publish feature make sure the Emit debugging information checkbox is checked.  

  • Jitu

    JParrish said:
    ScanIAm wrote:
    
    I'm not familiar with how to set this up for web remote deployments, but if you have control over what shows up in the email, then look at

    System.Exception.StackTrace

    it's part of the exception object, and it should hold the stack trace and line numbers (if they are available).


    Thanks.. but yes the template formatting the email includes the full stack trace, which would contain the line number. That is the part I don't understand, it should show me the line number since it was compiled for debug and symbols for other libraries are there. Expressionless
    test..

  • pmatsinopou​los

    hi,
    did you find answer to this problem?
    I have the same problem

  • atitpatel

    One reason i know is that your identity impersonation is set to true in your web.config.

    Turn to false and you will see it.

  • Drevis

    atitpatel said:

    One reason i know is that your identity impersonation is set to true in your web.config.

    Turn to false and you will see it.

    i have the same problem! Sad

Comments closed

Comments have been closed since this content was published more than 30 days ago, but if you'd like to continue the conversation, please create a new thread in our Forums, or Contact Us and let us know.