question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

SourceLink generating incorrect URLs when configured with GitHub Enterprise URL

See original GitHub issue

I have a repository hosted on an internal GitHub Enterprise server. I’ve configured a .NET 5 solution to use Source Link by referencing the Microsoft.SourceLink.GitHub package version 1.0.0. I’ve also manually configured all the properties required for reproducible builds (I am not using DotNet.ReproducibleBuilds). The <RepositoryUrl> property is set to https://internal.ghe/org/project.git (redacted).

According to NuGet Package Manager, my package was generated properly:

image

However, the URLs to each source file that are stored within my library’s PDB cause a 404 when I try to navigate to them:

image

I am not sure what the correct URL should be, nor what the GUID in the URL represents. However, when I go to a file in the GHE UI and click the Raw button, the domain changes to raw.internal.ghe. I suspect the URL generation algorithm SourceLink uses needs to be tweaked.

Issue Analytics

  • State:open
  • Created 2 years ago
  • Comments:6 (3 by maintainers)

github_iconTop GitHub Comments

2reactions
nathan-alden-hpcommented, Dec 7, 2021

@tmat The MSBuild property worked as far as generating the correct beginning. I still get a 404 when I try and access the URL, but apparently this is because in GHE, at least with my organization’s identity provider configuration, a ?token=... query string is appended when viewing a raw file. Obviously the NuGet package has no way of knowing what this token should be set to.

Hopefully when SourceLink is actually used from within Visual Studio (if it’s used) the token will be appended correctly based on stored credentials or some other mechanism. Otherwise, SourceLink with GHE seems to be useless.

1reaction
tmatcommented, Nov 5, 2021

@nathan-alden-hp

Could you try adding the following XML to your project?

<ItemGroup>
  <SourceLinkGitHubHost Include="internal.ghe" ContentUrl="https://raw.internal.ghe"/>
</ItemGroup>
Read more comments on GitHub >

github_iconTop Results From Across the Web

Incorrect source URI for GitHub.com and GitHub Enterprise
The source URLs that are generated do not work on GitHub Enterprise. ... Sourcelink is placing "raw" in the incorrect part of the...
Read more >
Issues · dotnet/sourcelink
Source Link enables a great source debugging experience for your users, ... SourceLink generating incorrect URLs when configured with GitHub Enterprise URL.
Read more >
SourceLink with GitHub Enterprise LDAP appears to fail #148
It appears that the URL generated by sourcelink just returns a 200 response with a login page & a redirect. ... It's unclear...
Read more >
Sourcelink TFS Git on a HTTP hosted server ...
@codeworxOS I'm using an on premise GitHub Enterprise. Microsoft.VisualStudio.Debugger.Utilities.SourceLink.SourceLinkClient will not send ...
Read more >
Source Link errors: This request was sent without ...
This is an error condition for sourcelink auth as there are no creds to send. You may try wiping out the creds for...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found