Partager via


The Importance of Debugger Symbols: or Reloading Symbols while Debugging

Have you ever attached to a managed application and been greeted with the following message ...

No symbols are loaded for any call stack frame.  The source code cannot be displayed.

... and found that breakpoints could not be set, or that single step attempts cause the application to run to completion)?

While preparing one of the demos for my MEDC 2006 presentation, I found myself in this state and was reminded of the importance of making sure the correct debugger symbols can be found by the Visual Studio 2005 debugger.

Often when attaching a debugger to a running application, you are not using the system on which the application was originally compiled, or the source code may have been moved since the application was built.  In these cases, the Visual Studio 2005 debugger is unable to resolve the location of the debugging symbols automatically.  To be able to successfully debug your application, you will need to instruct Visual Studio 2005 as to where to find the application's symbols (.pdb file) and to attempt to reload them.

To load symbols after you have attached to an application:

  1. On the Debug menu, select Windows and then Modules
    This will open the Modules window and show the binaries loaded as part of your application, including the .NET Compact Framework runtime.
  2. Right click anywhere within the Modules window and select Symbol Settings
  3. In the Options dialog, click on the folder icon (to the upper right)
  4. Type the location to the application's .pdb file (ex: c:\projects\TestApplication\bin\debug) and click OK
    If you have the Load symbols using the updated settings when this dialog is closed option selected (it is selected by default), the Visual Studio debugger will attempt to reload the symbols for all loaded modules.

With the correct symbols loaded, you will be able to set breakpoints and step through your code as if you had built and deployed the application from the current system.

Take care,
-- DK

Disclaimer(s):
This posting is provided "AS IS" with no warranties, and confers no rights.