unable to connect to vsdbg in Kubenetes cluster error: Error: Unknown switch '--attach'

11/18/2019

End result:

I want to connect my Visual Studio debugger to a .net Core application running as a pod on a Kubernetes cluster.

I am currently trying to follow this guide: Debugging ASP.NET core apps in Kubernetes

I am trying to run the following Powershell command to connect to the debugger:

Write-Host '1. searching pod by selector:' $Selector '...';
$pod = kubectl get pods --selector=$Selector -o jsonpath='{.items[0].metadata.name}';

Write-Host '6. seaching for' $cmd 'process PID in pod:' $pod '...';
$prid = kubectl exec $pod -i -- pidof -s 'dotnet';

Write-Host '7. attaching debugger to process with PID:' $pid 'in pod:' $pod '...';
kubectl exec $pod -i -- /vsdbg/vsdbg --interpreter=mi --attach $prid;

The issue I'm having is on the last step, when i try to run this I get the following error:

Error: Unknown switch '--attach=1'.

I have tried looking at the help file, which does not contain another similar looking parameter to attach to the process ID

Question, How do I get the vsdbg to attach?

-- Mr Giggles
asp.net-core
c#
kubernetes
remote-debugging

0 Answers