Visual Studio从SymbolCache加载不正确的文件版本以进行调试

时间:2021-05-09 00:42:51

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.

我正在使用符号/源服务器来存储私有nuget包。使用-symbols标志使用“nuget pack”命令构建软件包,然后将其推送到服务器。

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.

Visual Studio(2015)在第一次调试特定包时正确地从服务器加载符号/源。当我尝试调试该包的不同版本时,会出现此问题。只要SymbolCache目录中有任何可用的源文件版本,Visual Studio就会使用该文件进行调试。

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.

当我清除SymbolCache目录时,它会再次从符号/源服务器加载正确的文件版本并将其放入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. 我有一个包“testpackage”,Application-A使用版本1.0.1,Application-B使用testpackage版本1.0.2
  3. I debug into code from testpackage through Application-B
  4. 我通过Application-B从testpackage调试代码
  5. The source files for testpackage 1.0.2 are copied to the SymbolCache directory and used correctly while debugging
  6. testpackage 1.0.2的源文件被复制到SymbolCache目录并在调试时正确使用
  7. I debug into code from testpackage through Application-A
  8. 我通过Application-A从testpackage调试代码
  9. The source files from version 1.0.2 are used instead of 1.0.1
  10. 使用版本1.0.2的源文件而不是1.0.1

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

在步骤6中,我希望将版本1.0.1复制到SymbolCache目录并用于调试

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.

我在调试期间检查了模块窗口,它显示从缓存加载了正确的pdb,或者如果不存在,则从符号服务器加载pdb。每个包版本都有一个包含符号文件的目录。

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

即使使用了正确的符号文件,它仍会加载错误的源文件,直到我清除SymbolCache。

1 个解决方案

#1


1  

Visual Studio loads the incorrect file version from SymbolCache for debugging

Visual Studio从SymbolCache加载不正确的文件版本以进行调试

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.

此问题可能是由pdb文件不匹配引起的。您可以在模块窗口中选择调试 - > Windows - >模块,右键单击符号项,选择符号加载信息,从弹出窗口中,您可以看到是否加载了pdb文件以及加载了pdb文件的位置。

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).

如果从不正确的路径加载pdb文件,您可以通过单击符号设置...按钮(在符号加载信息对话框中)指定正确的符号位置。

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.

如果从正确的位置加载pdb文件,您的问题可能是由pdb文件不匹配引起的,清除SymbolCache目录并从符号/源服务器重新加载它可能会有所帮助。

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.

AFAIK,如果您的SymbolCache文件夹具有之前从Symbol Server下载的旧版本符号文件,则在您调试应用程序期间不会再次下载它。一个可能的原因是,由于您的符号文件具有相同的名称但版本不同,因此VS调试将首先从SymbolCache文件夹中搜索并加载符号文件,然后如果您的SymbolCache文件夹没有,则从符号服务器或其他文件下载它。他们。这就是你遇到这个问题的原因。

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

我可以建议的解决方法:使用不同的名称会更好。

Hope this can help you understand this question.

希望这可以帮助您理解这个问题。

#1


1  

Visual Studio loads the incorrect file version from SymbolCache for debugging

Visual Studio从SymbolCache加载不正确的文件版本以进行调试

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.

此问题可能是由pdb文件不匹配引起的。您可以在模块窗口中选择调试 - > Windows - >模块,右键单击符号项,选择符号加载信息,从弹出窗口中,您可以看到是否加载了pdb文件以及加载了pdb文件的位置。

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).

如果从不正确的路径加载pdb文件,您可以通过单击符号设置...按钮(在符号加载信息对话框中)指定正确的符号位置。

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.

如果从正确的位置加载pdb文件,您的问题可能是由pdb文件不匹配引起的,清除SymbolCache目录并从符号/源服务器重新加载它可能会有所帮助。

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.

AFAIK,如果您的SymbolCache文件夹具有之前从Symbol Server下载的旧版本符号文件,则在您调试应用程序期间不会再次下载它。一个可能的原因是,由于您的符号文件具有相同的名称但版本不同,因此VS调试将首先从SymbolCache文件夹中搜索并加载符号文件,然后如果您的SymbolCache文件夹没有,则从符号服务器或其他文件下载它。他们。这就是你遇到这个问题的原因。

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

我可以建议的解决方法:使用不同的名称会更好。

Hope this can help you understand this question.

希望这可以帮助您理解这个问题。