ctaggart / SourceLink

Source Code On Demand
MIT License
356 stars 55 forks source link

SourceLink package for Tfs produces incorrect path in PDB #388

Closed xen22 closed 4 years ago

xen22 commented 5 years ago

Nuget package version: Microsoft.SourceLink.Tfs.Git 1.0.0-beta2-19367-01

When adding support for SourceLink to a project using the above package, with the following entry in the csproj file:

    <!-- Source Link -->
    <PackageReference Include="Microsoft.SourceLink.Tfs.Git" Version="1.0.0-beta2-19367-01">
      <PrivateAssets>all</PrivateAssets>
      <IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
    </PackageReference>
    <SourceLinkTfsGitHost Include="tfs-server.localdomain.com" VirtualDirectory="DefaultCollection" />
    <!-- Source Link -->

After generating the nuget package, the nuspec file contains correct path to the TFS repo:

    <repository type="git" url="https://tfs-server.localdomain.com/DefaultCollection/TestProject_git/_git/TestRepo" commit="1b9de839e28ad01332d7d213ec571cfaa6fe6693" />

However, the path generated and embedded inside the PDB (in the document entry) is incorrect:

https:///tfs-server.localdomain.com/DefaultCollection/TestProject_git/TestRepo/_apis/git/repositories/TestRepo/items?api-version=1.0&versionType=commit&version=1b9de839e28ad01332d7d213ec571cfaa6fe6693&path=/*"

This is then passed to Visual Studio, which is unable to find the source file:

https://tfs-server.localdomain.com/DefaultCollection/TestProject_git/TestRepo/_apis/git/repositories/TestRepo/items?api-version=1.0&versionType=commit&version=1b9de839e28ad01332d7d213ec571cfaa6fe6693&path=/Core.Api/Helpers/AuthTokenHelper.cs

The above path should not have a "TestRepo" before "/_apis/git/...". The correct path is:

https://tfs-server.localdomain.com/DefaultCollection/TestProject_git/_apis/git/repositories/TestRepo/items?api-version=1.0&versionType=commit&version=1b9de839e28ad01332d7d213ec571cfaa6fe6693&path=/Core.Api/Helpers/AuthTokenHelper.cs
ctaggart commented 4 years ago

Microsoft.SourceLink is from https://github.com/dotnet/sourcelink

xen22 commented 4 years ago

Thanks for the link. I entered a new issue for this on their site: https://github.com/dotnet/sourcelink/issues/414