Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Trying to port a library fails because of linksource test #228

Closed
halcwb opened this issue Jan 19, 2021 · 10 comments · Fixed by #267
Closed

Trying to port a library fails because of linksource test #228

halcwb opened this issue Jan 19, 2021 · 10 comments · Fixed by #267
Labels
upstream-bug Dependency has an issue

Comments

@halcwb
Copy link
Contributor

halcwb commented Jan 19, 2021

Describe the bug
I am trying to port an existing project to the MiniScaffold setup. I could create an empty scaffold project. But with my Utils.Lib I can't pass the sourcelink test. Somehow it doesn't add the urls and I get:

dotnet sourcelink test dist/Informedica.Utils.Lib.1.0.0.nupkg
17 Documents without URLs:
896fe14a8198e001d6414c79143ed01313cd0420332dd3def8b4362561c076db sha256 fsharp C:\Development\Informedica\libs\Informedica.Utils.Lib\src\Informedica.Utils.Lib\App.fs
bee40b116ca2c6d0e8ef3232a53246f3076da740a6449b900a9ddf786937e684 sha256 fsharp C:\Development\Informedica\libs\Informedica.Utils.Lib\src\Informedica.Utils.Lib\File.fs
etc...

To Reproduce
Steps to reproduce the behavior:

  1. clone the https://github.com/informedica/Informedica.Utils.Lib
  2. run the sourcelinktest target
  3. See error

Expected behavior
The git urls attached to the sources in the pdb file.

Any help greatly appreciated. Spend already some hours searching for a solution, but very little to go on.

@TheAngryByrd
Copy link
Owner

I don't have a solution off the top of my head. This would be a better issue for the sourcelink repo.

@halcwb
Copy link
Contributor Author

halcwb commented Jan 20, 2021

By the way, as I understand it, using snupkg is the recommended way to enable source link:

<Project>
  <PropertyGroup>
    <!-- Optional: Declare that the Repository URL can be published to NuSpec -->
    <PublishRepositoryUrl>true</PublishRepositoryUrl>

    <!-- Optional: Embed source files that are not tracked by the source control manager to the PDB -->
    <!-- This is useful if you generate files during the build -->
    <EmbedUntrackedSources>true</EmbedUntrackedSources>
  </PropertyGroup>

  <ItemGroup>
    <!-- Generate symbol packages (.snupkg) -->
    <!-- You must publish both packages, the package that contains the dll (.nupkg) and the one that contains the symbols (.snupkg) -->
    <IncludeSymbols>true</IncludeSymbols>
    <SymbolPackageFormat>snupkg</SymbolPackageFormat>

    <!-- Required -->
    <PackageReference Include="Microsoft.SourceLink.GitHub" Version="1.0.0-*" PrivateAssets="All"/>

    <!-- Required if your repository is on VSTS -->
    <!--<PackageReference Include="Microsoft.SourceLink.Vsts.Git" Version="1.0.0-*" PrivateAssets="All"/>-->

    <!-- Required if your repository is on GitLab -->
    <!--<PackageReference Include="Microsoft.SourceLink.GitLab" Version="1.0.0-*" PrivateAssets="All"/>-->
  </ItemGroup>
</Project>

@baronfel
Copy link
Collaborator

baronfel commented Jan 20, 2021

Don't use snupkg, it's so much work for so little reward. Just embed the pdb into your dll using <DebugType>embedded</DebugType> and enjoy. Not all tooling knows how to use snupkg, but all tooling can handle embedded pdbs.

@JohnTheGr8
Copy link
Contributor

I'm not sure if this is a proper solution, but I had the same issue earlier today and I solved it by adding:

<DebugType>embedded</DebugType>
<EmbedAllSources>true</EmbedAllSources>

to my project file.

Using <DebugType>embedded</DebugType> alone did not help...

@baronfel
Copy link
Collaborator

In my understanding, you'll want to use EmbedAllSources true if you're making use of the auto-generated AssemblyInfo.fs files. If you're generating via some other mechanism or handwriting those, then they'll just be source files in your repository already and you won't need it.

@TheAngryByrd TheAngryByrd added the upstream-bug Dependency has an issue label Jan 25, 2021
@TheAngryByrd
Copy link
Owner

I think it's time we remove that tool. While it did seem useful, it hasn't gotten updates in years at this point.

@TheAngryByrd
Copy link
Owner

Asked about an equivalent on the SourceLink repo. We'll either move to that or remove it from the tool chain.

@TheAngryByrd
Copy link
Owner

It’s WIP currently dotnet/sourcelink#678

@ImaginaryDevelopment
Copy link

Is there any work continuing on this? Just made a new project and first time trying to get it to publish to nuget (first package upload was done by hand). I'm not sure if my issue falls under this mini-scaffold issue or not. This is a fresh miniscaffolded project created today.

Finished (Success) 'DotNet:pack' in 00:00:05.5794834
Finished (Success) 'DotnetPack' in 00:00:05.5811715
Starting target 'SourceLinkTest'
C:\projects\ToMEHelper> "C:\Program Files\dotnet\dotnet.EXE"  sourcelink test "C:\projects\ToMEHelper\dist\ToMEHelper.0.1.1.nupkg" (In: false, Out: false, Err: false)
1 Documents with errors:
8c5cb62950a93ded73ce3fbc4752ae76b1a256f713862d446fc29fc045269ed8 sha256 fsharp C:\projects\ToMEHelper\src\ToMEHelper\Schema.fs
https://raw.githubusercontent.com/ImaginaryDevelopment/ToMEHelper/88e7d0d3c17af54acdccdf7f8e9b3f300543c273/src/ToMEHelper/Schema.fs
error: url hash does not match: 8c5cb62950a93ded73ce3fbc4752ae76b1a256f713862d446fc29fc045269ed8
sourcelink test failed
failed for lib/net5.0/ToMEHelper.pdb
1 files did not pass in C:\projects\ToMEHelper\dist\ToMEHelper.0.1.1.nupkg
Finished (Failed) 'SourceLinkTest' in 00:00:01.2437369

@TheAngryByrd
Copy link
Owner

Since this is an upstream problem, the only thing you can do as of right now is to remove the target.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
upstream-bug Dependency has an issue
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants