AdamsLair / duality

a 2D Game Development Framework
https://adamslair.github.io/duality
MIT License
1.4k stars 291 forks source link

Sourcelink not working #814

Closed Barsonax closed 4 years ago

Barsonax commented 4 years ago

Summary

Sourcelink as its implemented now does not work in duality. One missing thing that is needed is that the repository link is included in the nuspec and also the commit hash so that sourcelink knows how to find the source code.

The repository link and hash look entry in the nuspec should look like this (taken from https://www.nuget.org/packages/Singularity/0.17.5):

<repository type="git" url="https://github.com/Barsonax/Singularity" commit="033c260d09d006cd4b679aef23e63fae043ced8b" />

Instructions can be found here https://github.com/dotnet/sourcelink

There might be more missing. It might be easier to add the required entries and use dotnet pack which should handle things like adding the commit hash to the package.

ilexp commented 4 years ago

Wait, didn't that work in the past? What caused it to break?

Edit: Old issue for reference: #746

Barsonax commented 4 years ago

idk but iam not seeing this in the nuspecs in the source nor in the nuspecs of the downloaded nuget package from nuget. Haven't tested it in visual studio but without this sourcelink shouldnt be able to figure out the source code because the data is simply not there.

Barsonax commented 4 years ago

https://github.com/AdamsLair/duality/pull/758 only added a build.props file. It didnt changed anything about the build itself so how did this ever work?

ilexp commented 4 years ago

I believe the required metadata will end up in the .pdb files, and which repository is used was pulled dynamically from the git repo that was being built. And I guess the build props that were added extend the build process to do that?

Maybe I'm imagining things, but I think I have seen this working in a regular Duality install when looking into the post-PR fix. Just try to debug-step into Duality from a game plugin, or at least that's how I remember testing it.

ilexp commented 4 years ago

Just verified this with a fresh Duality install, works fine. I get the VS popup asking whether I want to download the source code to step into, and then I can do just that.

Barsonax commented 4 years ago

Inspected the pdb in the nuget package: image

so ye it seems to end up in the pdb itself.

Now iam wondering why it adds the git metadata in the nuspec with dotnet tooling.

Anyway seems I was wrong in assuming that is was broken based purely on the missing git metadata in the nuspec.

EDIT: https://github.com/dotnet/sourcelink#prerequisites-for-net-projects seems to sort of imply its a optional feature?

Barsonax commented 4 years ago

closing this as it turns out to be working properly