dotnet / dotnet/sourcelink

"Alternative PDB distribution" (including .pdb in .nupkg) does not work when consumed in netcoreapp3.0+ projects

Open
#628 4 comments 23 reactions 0 assignees View on GitHub
Dominant language
C#
Stars
1.4k
Forks
148
PR merge metrics
No merged PRs in 30d

Description

# Summary

The README and any other relevant documentation should be updated to reflect that "Alternative PDB Distribution" (i.e. embedding PDBs in Nuget packages) is no longer a viable solution going forward for .NET Core 3.0+ consumers until https://github.com/dotnet/sdk/issues/1458 is fixed.

Additionally, it would be beneficial to keep this issue open either to track either the upstream fix in dotnet/sdk, or some other fix more fundamental to sourcelink itself (for example, a revival of https://www.nuget.org/packages/SourceLink.Copy.PdbFiles)

# Details

The "Alternative PDB Distribution" section on the README (https://github.com/dotnet/sourcelink#alternative-pdb-distribution) no longer enables Sourcelink to function for libraries consumed by netcoreapp3.0+ projects. This is due to a change in .NET Core 3.0 to how Nuget package dlls are consumed - prior to 3.0, they were consumed directly out of the Nuget package cache folder, allowing the PDBs to be discovered as they were readily sitting alongside their DLL on disk. In 3.0, the DLLs are copied to the project's output folder but the PDB is not, leaving no way for the debugger to locate the PDB when it needs to.

This has already been reported here by another user in https://github.com/dotnet/sourcelink/issues/567, but that user self-closed their issue 20 minutes after opening it. My aim here with this issue is to have the README updated to clarify that this strategy no longer works. There are still valid reasons to embed the PDBs in the nupkg even now that `.snupkg` exists - one of which is distribution of private packages from private feeds where support for `.snupkg` doesn't exist yet.

# Additional Reading

Related reading to this issue and why this no longer works in 3.0+ projects can be found in the following:

* https://github.com/dotnet/sdk/issues/1458#issuecomment-537681786 - Issue originally filed about .NET Framework projects using the new project system. As of .NET Core 3.0, this issue now applies to .NET Core 3.0 projects in addition to .NET Framework projects.
* https://github.com/dotnet/core/issues/3587 - Another issue for the same issue filed against dotnet/core, closed as a dupe of https://github.com/dotnet/sdk/issues/1458.
* https://github.com/dotnet/sdk/issues/3161 - Discussion of the issue in dotnet/sdk, also closed as a dupe of https://github.com/dotnet/sdk/issues/1458.
* https://github.com/dotnet/sdk/blob/master/src/Tasks/Microsoft.NET.Build.Tasks/targets/Microsoft.PackageDependencyResolution.targets#L35-L39 - Part of the actual code in dotnet/sdk that is responsible for copying Nuget package DLLs to the build output.
* https://github.com/dotnet/sdk/pull/2646 - PR that introduced this change in dotnet/sdk.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.