All of sudden having issue in remote debugging via VS Code using launch.json and remote debugger installed in docker container for .net core project..
The error msg clearly tells about what the issue is, which to me doesn’t make any sense looking at the file comparing to the error pointing to. (the local file being used btw looks exactly same content as master branch of file in this link: remoteProcessPickerScript)
And here is the error I am getting as trying to attach the remote debugging feature of VS Code to the pod via dotnet environment:
kubectl exec -i pod-name -- /bin/sh -c "sh -s" < "c:....vscodeextensionsms-dotnettools.csharp-2.10.28-win32-x64scriptsremoteProcessPickerScript"
stderr: sh: 30: Syntax error: "}" unexpected (expecting "then")
command terminated with exit code 2
2
Answers
I encountered the same issue and in my case, it was related to the line ending of the remoteProcessPickerScript file. I worked around it by opening it in VS Code and changing the line endings from CRLF to LF and re-running.
However, I’m not sure of the root cause of this issue since the file on the master branch has the proper line endings.
Make sure the
remoteProcessPickerScript
in your local.vscode
directory matches exactly with the one in the master branch of the GitHub repository. Any deviation could cause syntax errors.The script might be written for a specific shell (like bash), but it is being interpreted by another (like sh). Make sure the script’s shebang line (if any) matches the shell used in the container.
If you are on a Windows machine, the line endings in the script might be
CRLF
instead of the Unix-styleLF
. That can cause issues in Unix environments.Also, if there are special characters in the script, they might need to be escaped differently when passed through
kubectl exec
.For testing, try running the script in the container’s shell directly