Skip to content

Remote debugging with Docker doesn't work #6735

@AlexandrStarov

Description

@AlexandrStarov

Environment data

dotnet --info output: dotnet 6
VS Code version: 1.85
C# Extension version: 2.13.10

OmniSharp log

Steps to reproduce

  1. Create a new IoT Edge Solution according to the documentation https://learn.microsoft.com/en-us/azure/iot-edge/tutorial-develop-for-linux?view=iotedge-1.4&tabs=csharp&pivots=iotedge-dev-ext
  2. Run edge solution locally
  3. Try to attach to the remote process according to the documentation https://learn.microsoft.com/en-us/azure/iot-edge/debug-module-vs-code?view=iotedge-1.4&tabs=c&pivots=iotedge-dev-ext
  4. See error

Expected behavior

VS Code is attached to the remote process.

Actual behavior

The VSDBG is not installed:
image

The error appears:

Starting: "docker" exec -i DataProcessor sh -c "~/vsdbg/vsdbg --interpreter=vscode"
Error from pipe program 'docker': sh: 1: /home/moduleuser/vsdbg/vsdbg: not found
The pipe program 'docker' exited unexpectedly with code 127.

Additional context

Docker file:

FROM mcr.microsoft.com/dotnet/runtime:6.0 AS base

RUN apt-get update &&
apt-get install -y --no-install-recommends unzip procps &&
rm -rf /var/lib/apt/lists/*

RUN useradd -ms /bin/bash moduleuser
USER moduleuser
RUN curl -sSL https://aka.ms/getvsdbgsh | bash /dev/stdin -v latest -l ~/vsdbg

FROM mcr.microsoft.com/dotnet/sdk:6.0 AS build-env
WORKDIR /app

COPY *.csproj ./
RUN dotnet restore

COPY . ./
RUN dotnet publish -c Debug -o out

FROM base
WORKDIR /app
COPY --from=build-env /app/out ./

ENTRYPOINT ["dotnet", "DataProcessor.dll"]

Launch config:

      {
        "name": "DataProcessor Remote Debug (.NET Core)",
        "type": "coreclr",
        "request": "attach",
        "processId": "${command:pickRemoteProcess}",
        "pipeTransport": {
            "pipeProgram": "docker",
            "pipeArgs": [
                "exec",
                "-i",
                "DataProcessor",
                "sh",
                "-c"
            ],
            "debuggerPath": "~/vsdbg/vsdbg",
            "pipeCwd": "${workspaceFolder}",
            "quoteArgs": true
        },
        "sourceFileMap": {
            "/app": "${workspaceFolder}/modules/DataProcessor"
        },
        "justMyCode": true
    }

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions