srctool 声称它已经提取了源文件,但只是列出了它们的 URL

srctool claims it has extracted source files, but just lists their URLs

我有一个源索引的 PDB,但 Visual Studio 在调试时不会尝试下载适当的源(使用 Fiddler 验证),即使它确实在符号缓存中创建了正确的目录结构(即在src/ 子目录)。为了解决我使用的问题 srctool.exe:

srctool -x myfile.pdb

但是,这只会导致列出 URL;它不会尝试下载它们:

https://myurl.com/bitbucket/projects/BLAH/repos/MyRepo/browse/Src/SomeDir/SomeFile.cs?at=05bff5155beece6c7e6acde97f7aeefc7b65e2cf&raw
...
myfile.pdb: 20 source files were extracted.

pdbstr 的输出如下:

SRCSRV: ini ------------------------------------------------    
VERSION=2    
SRCSRV: variables ------------------------------------------
RAWURL=https://myurl.com/bitbucket/projects/BLAH/repos/MyRepo/browse/%var2%?at=05bff5155beece6c7e6acde97f7aeefc7b65e2cf&raw    
SRCSRVVERCTRL=https    
SRCSRVTRG=%RAWURL%    
SRCSRV: source files ---------------------------------------   
E:\AnotherDir\workf49bd3ba978a6f5\Main\Src\SomeDir\SomeFile*Src/SomeDir/SomeFile
...
SRCSRV: end ------------------------------------------------

如果有人能指出正确的方向以弄清楚发生了什么,我将不胜感激。

SRCSRV 不适用于查询 URL(请参阅 this issue and this issue)。

如果您使用的是 public Bitbucket 存储库,则可以使用类似 this acceptance test 的模式;也就是说,

RAWURL=https://bitbucket.org/BLAH/MyRepro/raw/05bff5155beece6c7e6acde97f7aeefc7b65e2cf/%var2%

不过,我不确定私人 Bitbucket 安装是否支持这种语法。查看 this issue 了解更多信息 - 从我的简要阅读来看,它们似乎支持没有查询字符串的原始文件,但不清楚是否可以指定没有查询字符串的提交哈希。

从对其他问题的评论来看,似乎一个常见的解决方法(对于私人 Bitbucket 安装)是设置 url 重写或一个可以采用 SRCSRV 友好 URL 的小型直通 Web 服务。


关于 srctool,我认为它的输出有点误导,但在技术上是正确的。对于 VS 可以 下载的正确源索引的 PDB,它的行为确实相同。

以这种方式映射的 PDB 指定 SRCSRVTRG(目标)而不是 SRCSRVCMD(下载命令)。 SRCSRV is supposed to check the target and - if the file is not there - it will execute the download command:

Next, it expands the SRCSRVTRG variable using VAR1 to VARn. If the file is already in this location, it returns the location to the caller.

Otherwise, it expands the SRCSRVCMD variable to build the command needed to retrieve the file from source control and copy it to the target location. Finally, it executes this command.

在这种情况下,目标是实际的 HTTPS URL。从技术上讲,该文件已经在 "at" 那个位置,所以 SRCSRV 只是 returns 文件位置,并且 srctool 报告它已经在那里(带有误导性的 "extracted" 消息)。

当 VS 确实下载文件时,它 将其存储在本地的符号缓存下,但这是此过程的进一步步骤;将它存储在那里并不是绝对必要的。