Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make csharp.listRemoteProcess support images without ps #4096

Closed
gregg-miskelly opened this issue Sep 30, 2020 · 2 comments
Closed

Make csharp.listRemoteProcess support images without ps #4096

gregg-miskelly opened this issue Sep 30, 2020 · 2 comments

Comments

@gregg-miskelly
Copy link
Contributor

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

  1. Scaffold a .NET (Core) app
  2. With the C# extension, add the build and debug assets
  3. With the Docker extension, do Add Dockerfiles.... Say "Yes" to Compose files.
  4. Right click docker-compose.yaml and do Compose Up.
  5. 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 one dotnet process exists in the container, but in some scenarios--like dotnet watch--more than one exists)
  6. 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.

@ssaraswati
Copy link
Contributor

This is implemented now in 1.25.0 and should work in both Alpine and Debian based Docker images

@JoeRobich
Copy link
Member

Thanks for confirming @ssaraswati. Closing this issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants