Make csharp.listRemoteProcess support images without ps
gregg-miskelly opened this issue · 2 comments
Issue Description
The csharp.listRemoteProcess
command would be helpful in Docker extension scenarios, because our debugging all happens through a pipe program (namely, docker exec
). However, the implementation of it doesn't work in the Debian .NET base image because ps
isn't present.
Steps to Reproduce
- Scaffold a .NET (Core) app
- With the C# extension, add the build and debug assets
- With the Docker extension, do
Add Dockerfiles...
. Say "Yes" to Compose files. - Right click
docker-compose.yaml
and do Compose Up. - Go to the Debug tab. Add a debug configuration for "Docker .NET Core Attach (Preview)". Add
"processId": "${command:csharp.listRemoteProcess}"
to that config. (Ordinarily this isn't needed since only onedotnet
process exists in the container, but in some scenarios--likedotnet watch
--more than one exists) - F5 that config
Expected Behavior
Remote processes are listed to pick from
Actual Behavior
Error popup reading "See remote-attach output".
On a Debian image:
Executing: docker exec -i netcore2020_netcore2020_1 sh -s < "c:\Users\bwater\.vscode\extensions\ms-dotnettools.csharp-1.23.1\scripts\remoteProcessPickerScript"
Linux
stderr: sh: 1: ps: not found
Error Message: Command failed: docker exec -i netcore2020_netcore2020_1 sh -s < "c:\Users\bwater\.vscode\extensions\ms-dotnettools.csharp-1.23.1\scripts\remoteProcessPickerScript"
sh: 1: ps: not found
Changing the implementation of this to avoid ps
, or adding an alternative command that uses OS APIs*, would enable this scenario.
*Note: VSDBG is present in the container so scripts are not the only option
Work around
Modify your docker file to add the procps
package.
This is implemented now in 1.25.0 and should work in both Alpine and Debian based Docker images
Thanks for confirming @ssaraswati. Closing this issue.