Veryfing symbols after upload to SymbolSource
Although with the release of NuGet integration uploading symbols and sources to SymbolSource became a matter of simply invoking one command, it is still possible to mix up packages and end up uploading binaries and symbols that do not match. SymbolSource will of course verify the integrity of an incoming package, but there is no way for it to stop you from uploading a package to nuget.org with different binaries.
This post will show you how to quickly verify that symbols can be downloaded for a given set of binaries.
You will need to set up a few things first:
Download Debugging Tools from the Windows SDK - run the SDK web installer and select Debugging Tools for Windows under Common Utilities to download and install just the bits that you will need.
Prepare two directories - the first one with all the binaries that you will be verifying (e.g.
Z:\Binaries
) and a second one as a cache for downloaded symbols (e.g.Z:\Symbols
).The binary directory will be searched recursively, so you can extract many packages into separate subdirectories. Make sure there are no PDB files present.
Open a command prompt and add Debuggin Tools to your PATH variable to make things easier:
set PATH=%PATH%;C:\Program Files\Debugging Tools for Windows (x64)
Now you can do the actual verification:
-
Run
symchk.exe
on the entire binary directory:symchk.exe Z:\Binaries /su "SRV*Z:\Symbols*http://srv.symbolsource.org/pdb/Public" /oi /op /r
-
If everything goes well, this will result in output similar to the following:
SYMCHK: Orchard.Core.dll PASSED - PDB: Orchard.Core.pdb DBG: <N/A> SYMCHK: Orchard.exe PASSED - PDB: Orchard.pdb DBG: <N/A> SYMCHK: Orchard.Framework.dll PASSED - PDB: Orchard.Framework.pdb DBG: <N/A> SYMCHK: Orchard.WarmupStarter.dll PASSED - PDB: Orchard.WarmupStarter.pdb DBG: <N/A> SYMCHK: FAILED files = 0 SYMCHK: PASSED + IGNORED files = 4
-
Most often you will see these two types of errors:
SYMCHK: FluentNHibernate.dll FAILED - FluentNHibernate.pdb mismatched or not found SYMCHK: FluentNHibernate.xml IGNORED - Not an executable file (file does not have a DOS header)
-
When you do come across a failure, it's worth investigating with the following command:
symchk.exe Z:\Binaries\FluentNHibernate.dll /su "SRV*Z:\Symbols*http://srv.symbolsource.org/pdb/Public" /v
-
In verbose mode
symchk.exe
will output a lot of information about the symbol loading process, among which will be lines like the following:DBGHELP: Symbol Search Path: SRV*Z:\Symbols*http://srv.symbolsource.org/pdb/Public DBGHELP: No header for Z:\Binaries\FluentNHibernate.dll. Searching for image on disk DBGHELP: Z:\Binaries\FluentNHibernate.dll - OK SYMSRV: Z:\Symbols\FluentNHibernate.pdb\01D37CC489F649B89A1122C482A574CB1\FluentNHibernate.pdb not found SYMSRV: http://srv.symbolsource.org/pdb/Public/FluentNHibernate.pdb/01D37CC489F649B89A1122C482A574CB1/FluentNHibernate.pdb not found
This shows clearly that a PDB for the given DLL wasn't found on SymbolSource.
A quick reference to symchk.exe options
The meaning of the symchk.exe switches that were used in the examples is the following:
Switch | meaning |
---|---|
/su | Search the following symbol path and always update. |
/r | Scan the directory recursively for binaries. |
/oi | Additionally list files that were ignored. |
/op | Additionally list files that passed verification. |
/op | Verbose mode. Inform about every action taken. |
Ideas for improvements
If you have any ideas how this process could be improved, please share them with us. One possibility is to wrap symcheck.exe
and nuget.exe
into a script that would just take a package name and version and output a yes/no result. Perhaps there are other ways?