Share via


Remote Debugging managed applications in VS 2012- managing symbols

Following write up is from Prabhat Tandon, Support Escalation Engineer, confirmed and approved by product group

Here Prabhat has compiled steps for remote debugging comprehensively based on his experience and troubleshooting scenarios with customers.

Remote Debugging managed applications in VS 2012- managing symbols

SAMPLE SCENARIO

You are trying to remote debug a managed application using Visual Studio 2012 Remote debugger. Attaching to the process is successful.

Symbols are placed side-by-side with the binaries on the remote machine.

However, the debugger is not able to load the PDB symbol from the remote machine.

o Visual Studio 2010 SP1 is able to load the symbols successfully at the first attempt.
 
o With Visual Studio 2012 you verified that the symbols are present at the remote location. It appears that  there wasn't any attempt to load them though :
 
…\WindowsFormsApplication1.pdb: Cannot find or open the PDB file.
<Snip>
 
What are symbols?

Symbols store debugging information. Most of the compilers stores debugging information in a separate file with an extension .pdb. These files contains:

a. Functions, static and global variables,
b. A list of object files that are responsible for sections of code in the executable
c. Frame pointer optimization information (FPO)
d. Name and type information for local variables and data structures,
e. Source file and line number information

In native world, it plays a key role. In managed world, even though .Net binaries are far more self-descriptive than native binaries, having symbols increase your debugging experience. For example, it provides you line-numbers and local variable names.

Why the difference?

Here is the list of possible recommendations:
1)      If you are using team build, add the share path to the build definition.
2)      Use symstore to setup a different symbol server from the following link:

             msdn.microsoft.com/en-us/library/ms681417.aspx
3)      Share out the folder on the remote machine and add this to the symbol path.
4)      If you are using MSI to install the application on the remote machine, install the same MSI on the local machine as is installed on the remote machine.
5)      Make a change to the build steps to copy the symbol files to a public share

Using SymStore

1. Remote Debugging managed applications in VS 2012- managing symbols

blogs.msdn.com/b/dsvc/archive/2013/09/25/remote-debugging-managed-applications-in-vs-2012-managing-symbols.aspx

2. Install it in the folder c:\debuggers

3. Create a share which will act as a symbol store. Provide Write permission to the person who will be having rights to add the symbols. Other users who just need to debug should have the read-only access to the share.

4. Create a batch file (e.g. RunMe.bat) which will execute the following (or similar command-line options ):
C:\Debuggers\symstore.exe add /r /f <REPLACE_WITH_PATH_OF_PDB_IN_BUILD_MACHINE>\*.pdb /s <SYMBOL_STORE> /t <PRODUCT_NAME_IN_DOUBLE_QUOTES> /v <PRODUCT_VERSION_IN_DOUBLE_QUOTES> /c <COMMENT_IN_DOUBLE_QUOTES>

5. We have an option to run this batch file as a post-build event in the Visual Studio :

 
6. Now when we see the symbol store (after few successful builds) we will find that for each build of the binary we have the PDB symbols stored 


 
7. We also need to setup the symbols settings on development machine to make sure that the symbol server has been updated (if not added to the _NT_SYMBOL_PATH environment variable)
 
 
Are you using TFS?
What if we are using TFS. Well, things get little easy. We can Publish symbols to a SymStore symbol store (PublishSymbols activity). The document Publish Symbol Data says how we can set it up.
-------------------------------------------------------END-------------------------------------------------------