dockervisual-studio-codenuget.net-8.0

How do I enable step through debugging of nuget dependencies in dotnet 8.0 app running inside a docker container in VSCode?


Following this guide https://www.youtube.com/watch?v=ds2bud0ZYTY "Debugging .NET Core in Docker with VSCode by That DevOps Guy", I have VSCode remote debugging my net8 application that is running inside of a docker container. I can step through my application code. The problem comes when I need to step inside of code from a nuget dependency. This works for others using Visual Studio Enterprise, but I'm on a mac using VSCode. The nugets include pdbs and I see them in .nuget/packages/. It works when I explicitly copy the pdb files into the directory alongside the dll files inside of the container. How do I get dotnet publish to include the pdb files of the nuget dependencies along with the pdb files of my application?

I've tried

RUN dotnet publish /p:DebugType=Full /p:DebugSymbols=true /p:PublishSymbols=true /p:CopyOutputSymbolsToPublishDirectory=true --configuration Debug --framework net8.0 -o /app

but it doesn't work. The /app directory includes all the dll files and my application's pdb files, but it doesn't include the pdb files of the nuget dependencies.

It works when I explicitly copy each of them like so

RUN cp /root/.nuget/packages/example.nuget.package/1.2.3/lib/net8.0/Example.Nuget.Package.pdb /app/

I just can't seem to find out how to do this as part of building/publishing?

PS. I know using JetBrains Rider is another option, but I'm trying to get this working using VSCode.


Solution

  • /p:CopyDebugSymbolFilesFromPackages=true works

    dotnet publish /p:DebugType=Full /p:DebugSymbols=true /p:PublishSymbols=true /p:CopyOutputSymbolsToPublishDirectory=true /p:CopyDebugSymbolFilesFromPackages=true --configuration Debug --framework net8.0 -o /app