Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Debugging C# production application with/without pdb file

I built an application that is handling an error and returning the following error msg:

System.NullReferenceException:  
Object reference not set to an instance of an object. 
  at MyApp.Submit_Click(Object sender,EventArgs e)

I'm not getting any stack trace and I don't see an issue with the exception not being properly thrown.

I have a few questions about how to capture this information:

  1. I am recording the exception.ToString() which usually gives me the exception, inner exception, and stacktrace in my code. Do I need the .pdb file to get the stack trace, or will the .pdb only get add the line numbers?
  2. I have a .pdb file in production with the associated dll but I believe the pdb file is from an older build. Could this cause problems with capturing debugging information and be worse than having no .pdb file at all?

Thanks for the help!

like image 273
AnotherDeveloper Avatar asked Apr 08 '26 21:04

AnotherDeveloper


1 Answers

No, you do not need the pdb to see the stack trace, but you will need it in order to get the line numbers. And, if you have an out of sync version, you may end up reporting incorrect line numbers.

Your error message does show you the stack trace, there just isn't much of one since it is a button click:

at MyApp.Submit_Click(Object sender,EventArgs e)
like image 96
competent_tech Avatar answered Apr 11 '26 10:04

competent_tech