Search code examples
c++visual-studiogithubpdb-filessourcelink

SourceLink: PDB File Name Casing Does Not Match Repository, Breaking SourceLink


Is there any way of configuring the linker in Visual Studio so that file names (and paths) embedded in the .pdb file maintain their casing?

We have a Visual Studio C++/Cli DLL that we'd like to package with NuGet. We want to use SourceLink so that our developers can step into the code, which is hosted on a (private) GitHub repository.

However, when trying to step into the source, Visual Studio (2019 16.2.2) reports an error:

Source Link Error

git-credential-manager.exe: Could not obtain credentials. Process failed with exit code -1. ERROR: The request failed with code 404 : "Not Found". Treating 404 as authentication failure. Some services return 404 instead of 401 for authentication failures.

Source Link URL: https://raw.githubusercontent.com/OurCompany/OurRepository/aca51f6e381401234e95b63949d150be04a0ea4a/ourproject/oursubfolder/thefile.cpp

Note that on the file-system and repository the file path uses camel-casing: Ourproject/OurSubFolder/TheFile.cpp.

When I replicate the request in Postman using Basic authorisation, it does indeed fail with 404. However, the problem seems to be that the URL constructed by Visual Studio uses lower-case characters for the filename and location; correcting the case makes the request work in Postman. GitHub URLs are of course case-sensitive and that's not configurable.

Opening the .pdb file in Notepad++ shows the filenames are indeed lower-case.

For what it's worth, changing ignorecase = false in the git .config file makes no difference.


Solution

  • I had the exact same issue. It turns out it's a known bug, and was fixed in VS2019. Unfortunately you need to upgrade to the latest tool chain (v142).