skip to Main Content

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


  1. Chosen as BEST ANSWER

    We fixed this ourselves by ensure the debug config was shown as in the steps and screenshot below.

    Simple scenario

    • ensure Debug solution configuration is selected
    • ensure the Startup Project is the docker-compose file
    • ensure Docker Compose is shown and then click it to start debugging

    enter image description here

    With 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.

    • Ensure the docker-compose file has profiles specified for the various services
    • in the toolbar > Docker Compose > Manage Docker Compose Launch Settings, select the Docker Compose profile

    enter image description here

    • Under each service, ensure the one you want to debug is Start debugging
    • Save
    • Start debugging as in the simple scenario above

  2. 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:
    Enable Just My Code Option
    Or, open the Modules window, select your dll, right click and select "Load Symbols":
    Load Symbols

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search