Skip to content
This repository has been archived by the owner on Apr 16, 2020. It is now read-only.

SourceLink not verifying files compiled by VS 2015? #102

Closed
allykzam opened this issue Aug 20, 2015 · 12 comments · Fixed by #104
Closed

SourceLink not verifying files compiled by VS 2015? #102

allykzam opened this issue Aug 20, 2015 · 12 comments · Fixed by #104
Milestone

Comments

@allykzam
Copy link

Trying to add a SourceLink build target to one of my projects at work, found that it wasn't verifying any of the source files. Followed the code in PdbChecksums.fs as best I can, and it looks like the source code is being filtered out because the "stream" length is 92 bytes instead of 88, as specified here.

Looked through the data and picked an arbitrary file out, the file's checksums (with the compiled line-endings), and the pdb data are:

File MD5:
01e341d418646658b3e264e78e134f3f

File SHA1:
8c4bc1ab08ac218b3ca03ec0c0bb22b09fa4bd25

PDB "stream" data:
b8d0123a6cc2d011b44200a0244a1dd2c4454b99e9e6d211903f00c04fa302a10b9d865a1166d311bd2a0000f80849bdec1618ff5eaa104d87f76f496383346014000000000000008c4bc1ab08ac218b3ca03ec0c0bb22b09fa4bd25

I'm not intimately aware of the details of PDB generation, but I can safely say the PDB data ends with the SHA1, and SourceLink is looking for MD5's. :)

@ctaggart
Copy link
Owner

Thanks for reporting this! Now we have two people reporting the same thing. @Thorium reported this last month, but haven't had time to look into it yet.

@ctaggart
Copy link
Owner

C# Roslyn uses SHA1 and SHA-256 that are 20 bytes and 32 bytes in length. The MD5 is 16 bytes in length. That explains why the stream length is 92 bytes. The guid for SHA1 is ec1618ff5eaa104d87f76f4963833460 and appears in the stream from bytes.[45..50]. The guid for SHA-256 is 0fd02988b8111342878b770e8597ac16. I could check for the guids, but checking the lengths should work again: 88, 92, 104.

@ctaggart
Copy link
Owner

@amazingant Can you try out build 281?

source https://ci.appveyor.com/nuget/ctaggart-sourcelink
nuget SourceLink.Fake 1.1.0-b281

or

choco source add -n SourceLink -s https://ci.appveyor.com/nuget/ctaggart-sourcelink
choco install SourceLink --version 1.1.0-b281 -y

@allykzam
Copy link
Author

After wiping my working directory and setting core.autocrlf = input, everything looks good so far as I can tell. Created a .pdb.srcsrv file to match the main project's output, and while the build script ran, the Project.CompilesNotLinked property contained what looks to be all of my source files.

@ctaggart
Copy link
Owner

If you install SourceLink.exe using the choco install, you can use the checksums --check option to test the pdb.

image

@allykzam
Copy link
Author

Had some issues with it initially, due to the proxy page I wrote to get to the team's private GitHub repos.

Now, I get back a nice list of files with their checksums, followed by .\Source\<ProjectName>\bin\Debug\<ProjectName>.pdb has 34 source files, 22 indexed, 12 not indexed, 22 passed, 0 failed. Looking at the output, looks like the 12 "not indexed" are six .xaml files and the temporary .g.vb files that MSBuild generated at compile-time for each XAML document.

@ctaggart ctaggart added this to the 1.1.0 milestone Aug 24, 2015
@ctaggart
Copy link
Owner

Thanks! I'll probably release 1.1.0 tomorrow.

@allykzam
Copy link
Author

In the "not your issue but worth mentioning" category, trying to debug in VS with my new pdb file, it looks like SRCSRV doesn't like the URL I built for it. Organization, repository, commit SHA, etc. are all GET params after a question-mark, and is less than pleased with that.

@ctaggart
Copy link
Owner

Correct. It doesn't support ?. See #94 for workarounds. I may start throwing an exception. Please add your workaround. I'd like to document solutions for others.

@allykzam
Copy link
Author

Would you think me insane if my workaround was a custom webserver running in fsi?

@ctaggart
Copy link
Owner

@allykzam
Copy link
Author

Ground-up just using a TcpListener, based on some F# async code I was playing with back in January or so? Gist of the server in case you want to laugh at it: https://gist.github.com/amazingant/fb88fedf7b99a758bf4d

Runs on port 8004, because this isn't the first time I gave up by writing a custom server; first time it's been running in fsi though. 😄

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants