Debugging an application after its been released can be a total pain.  So, over time I’ve collected some software and techniques for making it a bit easier on myself and my team.  We ship our product with a modified version of  Hans Dietrich’s XCrashReport to provide logs, system information, and minidumps when our application inevitably crashes. If you’re not already using something similar I would highly recommend checking it out.

This utility sends us lots of crash dump files and until now we’ve always had to dig back through our archives to find the corresponding symbols and source code. But today I decided to rid us of the headache and set up a Symbol Server that could automatically determine our version and load it into Visual Studio 2008. The documentation can be a bit lacking at times, so I will try to illuminate the path that I took.

Step 1:
Download Debugging Tools for Windows. This provides you with symstore.exe which will be important for creating the symbol store.

Step 1.5:
Add the Debugging Tools directory to your path, so we have access to symstore.exe.

Step 2:
Create a folder on your build server and share it such that you have something like \BuildServer\Symbols available to your workstation.

Step 3:
For each build, execute a command like

symstore.exe add /r /p /f U:\Project\Bin*.* /s \BuildServer\Symbols /t “My Project” /v “Build 42”

Where _U:\Project\Bi_n is the directory with your .pdb files, \BuildServer\Symbols is obviously the symbols directory, “My Project” is the name of the project, and “Build 42” is the description of the version.

Step 4:
Open Visual Studio 2008,  go to Tools->Options->Debugging->Symbols. Set your cache directory to something like C:\SymbolCache, then add the location of the new symbol store: \BuildServer\Symbols.

Step 4.5:
At this point, it would be advisable to add the Microsoft Symbol Store to the locations list too: http://msdl.microsoft.com/download/symbols.

This should facilitate debugging crash dumps without tracking down the symbols. Also, check out the Source Server which will access your VCS system to pull out the correct source code files for you automatically too.