Remote process picker does not work (attach to Docker container scenario)
See original GitHub issueEnvironment data
MacOS BigSur 11.4 .NET SDK 5.0.301 VS Code 1.57.0 C# extension 1.23.12 Docker extension 1.13.0 Docker Desktop for Mac version 3.3.3
OmniSharp log
Steps to reproduce
- Create new web API project:
dotnet new webapi --no-https
- Open application folder in VS Code
- When prompted, add “required build files” to workspace
- Run
Docker: add Docker files to workspace
command. Select “.NET ASP.NET Core”, Linux, port 5000, yes to optional Docker Compose files - Change first line of the Dockerfile so that it reads
FROM mcr.microsoft.com/dotnet/aspnet:5.0-focal AS base
(note the image tag is5.0-focal
, not just5.0
- Right-click Dockerfile and choose “build image”
- Switch to Docker view (whale icon), right-click the application image (expand to see the “latest” tag), and choose “Run”
- Open .vscode/launch.json and add the following debug configuration
{
"name": "Docker .NET Core Attach",
"type": "docker",
"request": "attach",
"platform": "netCore",
"processId": "${command:pickRemoteProcess}"
}
- Make the added debug configuration active and execute it. Select “Individual Containers” group, then the running application container. When prompted, allow debugger to be copied to the application container.
Expected behavior
After the debugger is copied to the application container, the user should be prompted to select the process to attach to.
Actual behavior
An error message that says “No process with the specified id is currently running”
Additional information
When Docker extension resolves the debug configuration, it will return the following:
{
"name": "Docker .NET Core Attach",
"justMyCode": false,
"platform": "netCore",
"processId": "${command:pickRemoteProcess}",
"processName": undefined,
"request": "attach",
"type": "coreclr",
"sourceFileMap": {
"/src": "${workspaceFolder}"
},
"pipeTransport": {
"debuggerPath": "/remote_debugger/vsdbg",
"pipeCwd": "${workspaceFolder}",
"pipeProgram": "docker",
"quoteArgs": false,
"pipeArgs": [
"exec",
"-i",
"application_container_name"
]
}
}
(application_container_name
is the name of the running application container)
This used to work until recently–the user would be prompted to select the process to attach to. I suspect https://github.com/OmniSharp/omnisharp-vscode/pull/4509 might have broken this scenario.
FWIIW, the following launch configuration works as expected (assuming debugger bits have been already copied into the container):
{
"name": "Manual Docker attach",
"type": "coreclr",
"justMyCode": false,
"processId": "",
"request": "attach",
"sourceFileMap": {
"/src": "${workspaceFolder}"
},
"pipeTransport": {
"pipeCwd": "${workspaceFolder}",
"pipeProgram": "docker",
"pipeArgs": [
"exec",
"-i",
"application_container_name"
],
"debuggerPath": "/remote_debugger/vsdbg",
"quoteArgs": false
}
}
(leveraging the new functionality that prompts the user to select a process when processId
is left empty)
Issue Analytics
- State:
- Created 2 years ago
- Comments:19 (18 by maintainers)
Top GitHub Comments
Yep. That is exactly the
launch.json
configuration I used for testing and got a process listing.Here is the vsix of the omnisharp-vscode extension with the
${command:pickRemoteDockerProcess}
supported. csharp-1.23.13-pickDockerProcess.zipSo @WardenGnaw just to make sure I understand the implications: when new OmniSharp release ships, the following configuration should work (changing
pickRemoteProcess
topickRemoteDockerProcess
):