locked
Exception stacktrace did not shows the line number RRS feed

  • Question

  • User1487175000 posted

    Hi, 

    I am writing exception in file. I normally write stacktrace to the file. But sometime stack trace does not shows the line number. For example check this log

    2016-11-03 10:55:02,993 [43] ERROR - Exception - 
    System.Web.HttpUnhandledException (0x80004005): Exception of type 'System.Web.HttpUnhandledException' was thrown. ---> System.NullReferenceException: Object reference not set to an instance of an object.
       at nyDebitering.btnLoadMyConference_Click(Object sender, EventArgs e)
       at System.Web.UI.WebControls.Button.RaisePostBackEvent(String eventArgument)
       at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
       at System.Web.UI.Page.HandleError(Exception e)
       at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
       at System.Web.UI.Page.ProcessRequest(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
       at System.Web.UI.Page.ProcessRequest()
       at System.Web.UI.Page.ProcessRequest(HttpContext context)
       at System.Web.HttpApplication.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()
       at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)
    

    Thursday, November 3, 2016 9:59 AM

All replies

  • User-484054684 posted

    Hi Shahid,

    Probably your solution is built using Release mode (instead of Debug mode) or missing pdb file in the Bin folder.

    See this discussion http://stackoverflow.com/questions/628565/display-lines-number-in-stack-trace-for-net-assembly-in-release-mode 

    Thursday, November 3, 2016 10:37 AM
  • User1487175000 posted

    Hi,

    i have simple webform project i did not see pdb file in my bin folder. How to generate this file. should i simply copy from my local environment and upload to production server. Or i have to do more for production?

    Thanks

    Thursday, November 10, 2016 12:32 PM
  • User-484054684 posted

    It's not advisable to deploy the symbol files or any non-optimised files as you wouldn't want the end user to know what's happening in your code. Better approach would be to have smaller methods so you can pin point where's it going wrong and appropriate try catch blocks wherever possible so you will not leave the exception unhandled and thrown to user like above.

    Having said that, if you would like to deploy the pdb file, you can deploy it, as a short term fix to see what's going on.

    Before that, test it in a production-equivalent environment to be on safer side. 

    Thursday, November 10, 2016 3:29 PM
  • User1487175000 posted

    yea i understand it is not good to deploy pdb file on the production server. Most of my code inside the trycatch. 

    For example look this exception,  it says exception happend in Button1_Click this event is completed implemented in the try catch.

    2016-11-10 10:00:48,955 [44] DEBUG Conference - ++++++++++++++++++++++++++++++++++++
    2016-11-10 10:00:48,986 [44] ERROR Conference - Exception - 
    System.Web.HttpUnhandledException (0x80004005): Exception of type 'System.Web.HttpUnhandledException' was thrown. ---> System.NullReferenceException: Object reference not set to an instance of an object.
       at updateBooking.Button1_Click(Object sender, EventArgs e)
       at System.Web.UI.WebControls.Button.RaisePostBackEvent(String eventArgument)
       at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
       at System.Web.UI.Page.HandleError(Exception e)
       at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
       at System.Web.UI.Page.ProcessRequest(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
       at System.Web.UI.Page.ProcessRequest()
       at System.Web.UI.Page.ProcessRequest(HttpContext context)
       at System.Web.HttpApplication.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()
       at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)
    2016-11-10 10:00:48,986 [44] DEBUG Conference - ++++++++++++++++++++++++++++++++++++



    Thursday, November 10, 2016 3:40 PM
  • User-484054684 posted

    Ok cool. Good luck then! Let us know any further help required.

    Thursday, November 10, 2016 6:20 PM