Skip to content

.NET debugging with Compose, no breakpoints hit #3912

@karolz-ms

Description

@karolz-ms

Repro steps

  1. dotnet new api --name mygreatapi
  2. Open in VS Code, do "Docker: Add Docker files". When asked about Compose files, say yes.
  3. Set a breakpoint somewhere in the code.
  4. Follow the instructions to set up and start an attach-type debug session.
  5. Hit the API endpoint (e.g. using curl)

Expected

The breakpoint should be hit

Actual

The program starts, the debugger attaches successfully, but the breakpoint is NOT hit.

Additional information

This happens because the scaffolded Dockerfile uses hard-coded Release build configuration, and the scaffolded docker-compose-debug.yml file uses the Dockerfile without any customization.

To fix this issue we should probably define the application (.NET) build configuration as a build parameter for the Dockerfile, with default value set to Release. Then in the docker-compose-debug.yml file we can override the build configuration so that Debug is used when the app is launched via this Compose file.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions