I’m trying to debug two C# .NET 6.0 Docker containers from Visual Studio 2022, but the breakpoints I set always show "no symbols have been loaded".
The two Docker containers are in a docker-compose.yml
file, at version 3.9 and Docker Desktop shows them running okay.
In VS2022, I’ve tried Debug
> Attach to Process
with:
Connection Type
of "Docker (Linux Container)"Debug these Code types
set to "Managed (.NET Core for Unix)".
I can list the contents of the containers and see the .pdb
files.
I’ve tried deleting the containers and images in Docker Desktop, cleaning the VS solution and re-building and re-starting the containers, but get the same error.
2
Answers
We fixed this ourselves by ensure the debug config was shown as in the steps and screenshot below.
Simple scenario
Debug
solution configuration is selectedStartup Project
is thedocker-compose
fileDocker Compose
is shown and then click it to start debuggingWith this config, all our breakpoints worked as expected and we don’t need to Attach to Process any more.
We can still see our various containers and their logs in both Docker Desktop and in the VS Containers window.
Launch Profiles scenario
Additionally, we have it working on another solution that has Docker Compose Launch Profiles.
docker-compose
file has profiles specified for the various servicesStart debugging
You are probably experiencing an issue with the Just My Code feature.
The two easiest ways to get your symbols to load in this case are:
Uncheck "Enable Just My Code" in the debugger options:
Or, open the Modules window, select your dll, right click and select "Load Symbols":