redrobot
redrobot

Reputation: 989

Visual Studio loads the incorrect file version from SymbolCache for debugging

I'm using a symbol/source server to store private nuget packages. The packages are built using the "nuget pack" command using the -symbols flag and then pushed to the server.

Visual Studio (2015) correctly loads the symbols/source from the server the first time that particular package is being debugged. The problem occurs when I try to debug a different version of that package. Whenever there is any version of a source file available in the SymbolCache directory, Visual Studio will use that one to debug.

When I clear the SymbolCache directory, it does load the correct file version again from the symbol/source server and puts it in the SymbolCache.

example:

  1. I have a package "testpackage" with version 1.0.1 being used by Application-A and Application-B uses testpackage version 1.0.2
  2. I debug into code from testpackage through Application-B
  3. The source files for testpackage 1.0.2 are copied to the SymbolCache directory and used correctly while debugging
  4. I debug into code from testpackage through Application-A
  5. The source files from version 1.0.2 are used instead of 1.0.1

In step 6 I would expect version 1.0.1 to be copied to the SymbolCache directory and used in debugging

I checked the Modules window during debug, and it shows that the correct pdb is loaded from cache, or if not present the pdb is loaded from the symbol server. There is a directory with symbol files for each package version.

Even though the correct symbol file is used, it still loads the wrong source file until I clear the SymbolCache.

Upvotes: 1

Views: 1445

Answers (1)

Leo Liu
Leo Liu

Reputation: 76790

Visual Studio loads the incorrect file version from SymbolCache for debugging

This issue may caused by mismatch of the pdb file. You can select Debug -> Windows -> Modules, on the Modules window, right click the symbol item, select Symbol Load Information, from the pop up window, you can see whether the pdb file is loaded and where the pdb file is loaded from.

If the pdb file is loaded from incorrect path, you may specify a correct symbol location by clicking the Symbol Settings… button (on the  Symbol Load Information dialog).

If the pdb file is loaded from correct place, your issue may caused by mismatch of the pdb file, clear the SymbolCache directory and reload it from the symbol/source server may help.

AFAIK, If your SymbolCache folder had the old version symbols file which was downloaded from the Symbol Server before, it would not download it again during you debug your app. One possible reason is that since your symbol file has the same name but in different versions, the VS debugging would search and load the symbol file from your SymbolCache folder firstly, and then download it from the symbol server or others if your SymbolCache folder has no them. That's the reason why you got this issue.

A workarounds I could suggest: Using different names would be better.

Hope this can help you understand this question.

Upvotes: 1

Related Questions