Having private repositories on VSTS (Azure DevOps) I tried enabling SourceLink by adding the following to the .csproj file: https://github.com/dotnet/sourcelink#azure-devops-visual-studio-team-services
This does not seem to have any effect during debugging. There is an exception thrown in a local NuGet package and I can not navigate to it using the Call Stack windows since the pdb is not even loaded for that project.
I have "Enable Just My Code" disabled and SourceLink enabled inside Visual Studio.
What other changes do I need to make to enable SourceLink?
This may not be a direct answer, but it is well worth noting that you don't need SourceLink to get source level debugging. SourceLink is a clever way to put links in the PDB to source code in the cloud, in a git repo.
Another way to get portable source level debugging is to embed the source code directly in the PDB (EmbedAllSources=True
), then embed the PDB in the DLL (DebugType=embedded
). It's fairly efficient (20-30% larger .nupkg file) and doesn't suffer from the bug currently affecting separate PDBs.
Just add this to your project file:
<PropertyGroup>
<EmbedAllSources>True</EmbedAllSources>
<DebugType>embedded</DebugType>
</PropertyGroup>
and lo and behold you will be able to single step into the NuGet file generated from it. No other workarounds and no SourceLink packages are required.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With