Skip to content
This repository has been archived by the owner on Oct 4, 2021. It is now read-only.

exec -it {containerName} pidof dotnet is returning multiples PIDs #1

Open
icedog48 opened this issue Apr 14, 2019 · 11 comments
Open

exec -it {containerName} pidof dotnet is returning multiples PIDs #1

icedog48 opened this issue Apr 14, 2019 · 11 comments

Comments

@icedog48
Copy link

Hi, thanks for the extension !

While testing it, i run through a parsing error and found out it maybe be from the command
exec -it {containerName} pidof dotnet returning many PIDs

According to this putting a '-s' parameter would fix it

this way exec -it {containerName} pidof -s dotnet

@Dreamescaper
Copy link
Owner

Do you have multiple dotnet processes in your container?
-s would prevent from failure, but how can you know which dotnet process to attach to?

@icedog48
Copy link
Author

Yes i am running a container with integration tests in debug mode, as far as i can see, the container starts with 4 dotnet process ...

I know the process number because of the output i get from running the container

IntegrationTests                 | Build started, please wait...
IntegrationTests                 | Build completed.
IntegrationTests                 |
IntegrationTests                 | Test run for /app/tests/POCApplication.IntegrationTests/bin/Debug/netcoreapp2.2/POCApplication.IntegrationTests.dll(.NETCoreApp,Version=v2.2)
IntegrationTests                 | Microsoft (R) Test Execution Command Line Tool Version 15.9.0
IntegrationTests                 | Copyright (c) Microsoft Corporation.  All rights reserved.
IntegrationTests                 |
IntegrationTests                 | Starting test execution, please wait...
IntegrationTests                 | Host debugging is enabled. Please attach debugger to testhost process to continue.
IntegrationTests                 | Process Id: 82, Name: dotnet
IntegrationTests                 | Waiting for debugger attach...
IntegrationTests                 | Process Id: 82, Name: dotnet
```

@Dreamescaper
Copy link
Owner

I updated extension to have Process ID selection.
Could you test if it works fine before I publish it to marketplace?

https://github.com/Dreamescaper/AttachToDockerContainer/releases/download/0.1.1/AttachToDockerContainer.vsix

@nzp
Copy link

nzp commented May 16, 2019

I updated extension to have Process ID selection.
Could you test if it works fine before I publish it to marketplace?

https://github.com/Dreamescaper/AttachToDockerContainer/releases/download/0.1.1/AttachToDockerContainer.vsix

It installs fine, but it's not showing up in the menu. v0.1 works.

@Dreamescaper
Copy link
Owner

@nzp Could you let me know what VS version do you use? Have no idea how that could happen...

@deyishi
Copy link

deyishi commented Sep 16, 2019

I am using visual studio 2017 and running into the same issue.
I downloaded your source code.
It worked for me after making below changes in csproj
<PackageReference Include="Microsoft.VSSDK.BuildTools" Version="15.9.3039"> <IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets> <PrivateAssets>all</PrivateAssets> </PackageReference>
to
<PackageReference Include="Microsoft.VSSDK.BuildTools" Version="16.0.2262" />

@deyishi
Copy link

deyishi commented Sep 16, 2019

It would be nice if you could update it to show both pid and script created the process when selecting container process.

@Dreamescaper
Copy link
Owner

@deyishi
Sorry for delay. What do you mean by

script created the process

?

@deyishi
Copy link

deyishi commented Oct 4, 2019

So when you do
docker container top {container}

It lists containers and the command created them. Could that command be added to container process Id selection drop down? It hard to tell which process to debug just by Id alone.

@Dreamescaper
Copy link
Owner

Well, actually I have no idea how to do that. Problem is that docker {containerName} top and docker exec -it {containerName} pidof dotnet return different PIDs - first one is PID in host system, latter - in actual container.
And if I try to execute ps using docker exec, it shows simply dotnet for command, no arguments - not sure why.

@RodrigoTHD
Copy link

Hey guys, I think I solved this problem, I can send a PR.

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

No branches or pull requests

5 participants