Click here to Skip to main content
13,295,178 members (66,537 online)
Click here to Skip to main content
Add your own
alternative version


27 bookmarked
Posted 12 Jan 2012

How to use symbol server? (and why you really like to do it...)

, 13 Jan 2012
Rate this:
Please Sign up or sign in to vote.
How to setup .NET symbol server and enable production debugging without source code


While working on some project, we ran into a problem when some infrastructure code was separated from our solution and encapsulated into a sort of 3rd party dll. The problem was that when trying to debug this external dll, the debugger tried to look for the source code in a specific path – the path where the original source code was at the time of the compilation.

This is obviously a big problem –
1. When working with teams in different geographies, where each team is working on the same code but, but each team using a different development server
2. In production – you want to be able to debug you application with source code, without relying on the initial location of the source code

This post will concentrate on how to create PDB objects, objects used by the compiler to debug and find the source code, in a way it will look for the source code from a source control (TFS) instead of source files. You will see that these steps are really easy to follow (especially if you have already TFS and build configuration), so you can implement them in your project immediately.

This post is a compilation of many other interesting posts about this topic (see resources section at the end). it's intended to be short and to the point, to help your projects to become more "debuggable" with the least of efforts.

Thanks a lost for all the articles' authors - John Robbins, Cameron Skinner, and Ed Blankenship.


John Robbins did already a great work on describing what is a PDB file and how the debugger looks for PDB files in his must-read post.

To sum up, a PDB consists of information used by the debugger to perform it work. A .NET PDB contains two pieces of information, the source file names and their lines and the local variable names. The rest of the data, is already in the .NET metadata (e.g. public, private and static addresses, global variable names and addressses and more).

The debugger uses the name of the file and a GUID that's embedded in both the PDB file and the binary to look for the correct PDB version.

Using the code

In order to enable source control PDB, you need to follow these steps:

  1. Create a public build definition for you project (I won’t go on the general details of public build definition in post, but you can look for it here (look for the Build support section).
  2. Create a shared folder to be used as a drop folder. Drop folder is where the DLL’s and PDB’s will be placed by the public build. These DLL’s will be referenced in your code.
  3. Create a shared folder that will be used as you symbol server. A symbol server is a centralized place where your PDB’s will reside along with the required source information.
  4. Update the definition to use the drop location folder:
  5. Update the definition and set the path to publish symbols. This step does two things – both set the PDB location in the symbol server, AND, does something called source indexing, which create the mapping between the source code and source version. In order to do that, simply copy your symbol server UNC here:symbol_server.png
  6. That’s it – you are done with the definition of your public build. Now you need to actually build it, and prepare your client to work with the symbol server.

Now, How to debug with a symbol server?

  1. Make sure to reference the DLL’s from the drop location. You don’t have to reference the drop location directly, you can copy them to any folder you like. Make sure to check-in the external DLL’s and PDB’s along with your solution.
  2. In VS, go to DebugàOptions and Settings .... this will open the debugging sections in the setting dialog box.
  3. Go to the “Symbols” option, and add your symbol server (please note you may have several, each for each project , or one centralized). To do that, simply click the folder icon right in the top of the screen. At the end, it should look like:
  4. Go to the “general” option, and make sure to enable source server support:
  5. Now, you are ready to go and debug your third party code without having access to the source code. When you debug, you will face the following dialog when stepping in the 3rd party code:

The message above will appear for every new file the debugger need to source. If you don’t like that, create a file called SRCSRV.ini, place it in the <Visual Studio Install Directory>\Common7\IDE folder, and fill it with the following text:

[trusted commands]
tf.exe=<Visual Studio Install Directory>\Common7\IDE\tf.exe  

And that's it!

Points of Interest

Please note that if you follow these steps, you don't need to actually deploy the PDB files along with your code. TFS embed a unique GUID in the DLL file and the matching PDB file. Using the symbol server the information above, the debugger knows to lookup the correct PDB.

Pretty slick, ha?


What a developer need to know on PDB:

How to configure your own symbol server, and how to debug in production:

How to set symbol server in VS:

How to disable the dialog box of source files

PDB, TFS, and retention policy

Hard core symbol servers


January 12 - First revision.
January 13 - Added resources


This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


About the Author

Team Leader Intel
Israel Israel
I've been around at Intel for about 13 years, developing and leading SW information system projects.

I have extended experience in .NET (C#) and SQL development.

I'm currently located at OR for a 2Y assignmentOur current development environment is .NET 4.0 and SQL2008, we are using WPF 4.0 for UI, EF4 for data manipulation and WCF 4.0 for communicating from the client to the server.

Love design patterns and cool looking code.

Motto: "Are we having fun or what?"

You may also be interested in...


Comments and Discussions

QuestionNot sure good idea for PRODUCTION Pin
df4941-Dec-16 2:18
memberdf4941-Dec-16 2:18 
GeneralMy vote of 5 Pin
jawed.ace23-May-13 19:13
memberjawed.ace23-May-13 19:13 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

Permalink | Advertise | Privacy | Terms of Use | Mobile
Web04 | 2.8.171207.1 | Last Updated 13 Jan 2012
Article Copyright 2012 by baruchl
Everything else Copyright © CodeProject, 1999-2017
Layout: fixed | fluid