Welcome to the Inedo Forums! Check out the Forums Guide for help getting started.
If you are experiencing any issues with the forum software, please visit the Contact Form on our website and let us know!
ProGet fail to index symbol on a CPP DLL/PDB
-
I am trying to use symbol server with a package containing a DLL made with CPP (Visual studio 2012 compiler), and i cannot made it work. The compiled pdb shows the following info:
C:\Users\ggherardi>srctool.exe -r c:\Users\ggherardi\Sources\VDSMath\src\Debug\VDSMath.pdb c:\users\ggherardi\sources\vdsmath\src\vdsmath\fittingevaluator.cpp c:\users\ggherardi\sources\vdsmath\src\vdsmath\fitmanager.cpp <other files> C:\Users\ggherardi>pdbstr.exe -r -s:srcsrv -p:"c:\Users\ggherardi\Sources\VDSMath\src\Debug\VDSMath.pdb" <no output>
When i try to debug a program that references that DLL as a NuGet packages hosted in Proget, the PDB seems correctly downloaded, VS tells that the DLL has symbols loaded from the symbol cache, but i cannot step in into functions of that DLL. If i try to inspect the downloaded PDB i get this output:
C:\Users\ggherardi>srctool.exe -r c:\Users\ggherardi\VS2012Symbols\VDSMath.pdb\AA8E72D1DDB34A438DBF76B027E6D9C81\VDSMath.pdb c:\users\ggherardi\sources\vdsmath\src\vdsmath\fittingevaluator.cpp c:\users\ggherardi\sources\vdsmath\src\vdsmath\fitmanager.cpp <other files> C:\Users\ggherardi>pdbstr.exe -r -s:srcsrv -p:"c:\Users\ggherardi\VS2012Symbols\VDSMath.pdb\AA8E72D1DDB34A438DBF76B027E6D9C81\VDSMath.pdb" SRCSRV: ini ------------------------------------------------ VERSION=2 INDEXVERSION=2 VERCTRL=http SRCSRV: variables ------------------------------------------ SRCSRVVERCTRL=http PGSERVER=http://localhost:81/source-files PGFEED=Default PGPKGID=VDSMath PGPKGVER=1.0.99-b000000 HTTP_EXTRACT_TARGET=%pgserver%/%pgfeed%/%pgpkgid%/%pgpkgver%/%var2% SRCSRVTRG=%http_extract_target% SRCSRVCMD= SRCSRV: source files --------------------------------------- SRCSRV: end ------------------------------------------------
The strange part is that that there are no source files defined in the "SRCSRV: source files" section. Despite this, i can download source files from ProGet by navigating to one of the "source-files" url, for example:
http://localhost:81/source-files/Default/VDSMath/1.0.99-b000000/fittingevaluator.cpp
I am using ProGet Version 3.0.3 (Build 1), and I have an enterprise license.
Product: ProGet
Version: 3.0.3
-
UPDATE
Taking the ProGet srcsrv steam as example , I've created a new file
VDSMath.pdb.srcsrv
with the following content:SRCSRV: ini ------------------------------------------------ VERSION=2 INDEXVERSION=2 VERCTRL=http SRCSRV: variables ------------------------------------------ SRCSRVVERCTRL=http PGSERVER=http://localhost:81/source-files PGFEED=Default PGPKGID=VDSMath PGPKGVER=1.0.99-b000000 HTTP_EXTRACT_TARGET=%pgserver%/%pgfeed%/%pgpkgid%/%pgpkgver%/%var2% SRCSRVTRG=%http_extract_target% SRCSRVCMD= SRCSRV: source files --------------------------------------- c:\users\ggherardi\sources\vdsmath\src\vdsmath\fittingevaluator.cpp*fittingevaluator.cpp c:\users\ggherardi\sources\vdsmath\src\vdsmath\fitmanager.cpp*fitmanager.cpp <other files> SRCSRV: end ------------------------------------------------
I've then replaced the srcsrv stream in the PDB downloaded from ProGet with the following command:
pdbstr.exe -w -s:srcsrv -p:"c:\Users\ggherardi\VS2012Symbols\VDSMath.pdb\AA8E72D1DDB34A438DBF76B027E6D9C81\VDSMath.pdb" -i:"c:\Users\ggherardi\VS2012Symbols\VDSMath.pdb\AA8E72D1DDB34A438DBF76B027E6D9C81\VDSMath.pdb.srcsrv"
With this updated PDB i can step in library methods during debug, so the problem seems related to the way ProGet enumerate the source files referenced in the PDB.
-
UPDATE & FIX
To investigate the problem I've decompiled ProGet. The following code is extracted from
Inedo.ProGet.WebApplication.SimpleHandlers.SymbolServerHandler
:using (Stream stream = File.OpenRead(packagePath)) { var zipFile = new ZipFile(stream); var pdbEntry = zipFile.GetEntry(pdbPath); var nupkgSrcFiles = zipFile.Cast<ZipEntry>() .Where(e => e.Name.StartsWith("src/", StringComparison.OrdinalIgnoreCase)) .Select(e => e.Name.Substring("src/".Length)) .ToArray(); using (var pdbStream = new SeekableStream(() => zipFile.GetInputStream(pdbEntry), pdbEntry.Size)) { using (var pdbFile = new PdbFile(pdbStream, false, true)) { var pdbSrcFiles = pdbFile.EnumerateStreams() .Where(s => s.StartsWith("/src/files/", StringComparison.OrdinalIgnoreCase)) .Select(s => s.Substring("/src/files/".Length)) .ToArray(); foreach (string pdbSrcFile in pdbSrcFiles) { string nupkgSrcFile = nupkgSrcFiles.FirstOrDefault(x => pdbSrcFile.Replace('\\', '/').IndexOf(x, StringComparison.OrdinalIgnoreCase) >= 0); if (nupkgSrcFile != null) { Console.WriteLine("{0}*{1}", pdbSrcFile, nupkgSrcFile.TrimStart(new[] { '/' })); } } } } }
The problem is that for a CPP/PDB there are no stream whose name start with "/src/files/" and so no file are referenced in the resulting srcsrv stream. To resolve the issue ProGet should not try to parse the PDB but instead extract source using
srctool.exe
with a command like this:C:\Users\ggherardi>srctool.exe -r c:\Users\ggherardi\Sources\VDSMath\src\Debug\VDSMath.pdb
I've tested it and this seems to produce the expected results on both CPP and C# DLLs
-
Thanks so much! This has been logged as PG-208, and we plan to fix in the upcoming maintnence release (3.0.4)