I apologize if this is a trivial question but I’ve been a-googling since last night and cannot find what I’m looking for. I have a customer that is running a web-app and encountered a NullReferenceException.
They sent me the stack trace but it does not have line numbers in it. I recently inherited this project and so I have the original source code. Is there a way that I could debug it with what I currently have? In other words, is there some way that I can use my compiled source code (which matches what was deployed) so that I can match it up to the instruction where things went bad without having to put some special build on the remote server? I’m using VS 2017, by the way.
If you’re using JetBrains products you can generate PDBs that might help determine line numbers.
https://www.jetbrains.com/help/resharper/Generating_PDB_Files.html https://www.wintellect.com/visual-studio-remote-debugging-and-pdb-files/
I’m not using Jetbrains products but I do have PDB files both in my VS environment and on the deployed servers. From what I can glean, there are different types of PDB files that can be generated. For future releases, I can probably have the stack traces with line numbers.
Without line numbers in the stack trace, you are only going to be able to narrow it down to methods. If the exception is raised from code you call (such as an ArgumentOutOfRangeException
on an List indexer), you should be able to narrow further by checking which lines call that method. Sometimes you get lucky, and there is only one such call. Other times, most of the calls are surrounded by proper guards, but one isn’t and is the one causing the problem.
C# devs
null reference exceptions