Wednesday, January 28, 2009

Remote Debugging and Loading a Symbol File

While doing some exploratory SharePoint development, I ran across a peculiar situation. My development methods generally don't require a lot of remote debugging, but since I was exploring possibilities, I dove farther into it. I deployed my solution to my server, started remote debugging on the server, and attached to the w3wp worker processes.

I opened the Modules window (Ctrl+Alt+U) in Visual Studio and located my assembly. (Note: The image on the left does not contain my assembly, but is just for reference) The Symbol Status column had the phrase "Cannot find or open the PDB file." and didn't say "Symbols loaded." as I had expected. So, I tried to load the symboles by:
Right click on module -> "Load Symbols From" -> "Symbol Path"

This opened up an open file dialog. Selecting the PDB file on my hard drive produced an error about not being able to find the file. It was not immediately obvious why it couldn't find the file. After some experimentation, I discovered that the paths in the "Symbol File" column are specific to the computer being debugged and not translated by the remote debugging functionality. I had assummed that the symbol files loaded were from my local computer and not from the remote server. After I discovered this, I was able to correctly place the PDB file on the remote server, re-attach to the processes, and magicly the symbol loaded.

There isn't much information on the web on this topic, so hopefully this will save someone a headache.

No comments: