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)
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?
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.
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 - ++++++++++++++++++++++++++++++++++++
Member
297 Points
940 Posts
Exception stacktrace did not shows the line number
Nov 03, 2016 09:59 AM|shahid.majeed|LINK
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
Star
9052 Points
2255 Posts
Re: Exception stacktrace did not shows the line number
Nov 03, 2016 10:37 AM|Siva Krishna Macha|LINK
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
Thanks & Regards,
Siva
Member
297 Points
940 Posts
Re: Exception stacktrace did not shows the line number
Nov 10, 2016 12:32 PM|shahid.majeed|LINK
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
Star
9052 Points
2255 Posts
Re: Exception stacktrace did not shows the line number
Nov 10, 2016 03:29 PM|Siva Krishna Macha|LINK
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.
Thanks & Regards,
Siva
Member
297 Points
940 Posts
Re: Exception stacktrace did not shows the line number
Nov 10, 2016 03:40 PM|shahid.majeed|LINK
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.
Star
9052 Points
2255 Posts
Re: Exception stacktrace did not shows the line number
Nov 10, 2016 06:20 PM|Siva Krishna Macha|LINK
Ok cool. Good luck then! Let us know any further help required.
Thanks & Regards,
Siva