microsoft / microsoft/vscode-containers

Version 2.4.1 extension crash

Open
#442 10 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

language-server
Dominant language
TypeScript
Stars
139
Forks
87
Avg merge
9h 15m
Merged PRs (30d)
9

Description

Given the following in the Docker file:

RUN --mount=type=secret,id=registry-pat,env=REGISTRY_PAT \
    --mount=type=secret,id=registry-username,env=REGISTRY_USERNAME \
    echo -e "$YARN_REGISTRY:username=$REGISTRY_USERNAME\n$YARN_REGISTRY:_password=$(echo -n $REGISTRY_PAT | base64 --wrap=0)" > .npmrc

comment the last line during debugging session, i.e. # echo -e ...

Experience extension crash:

TypeError: Cannot read properties of undefined (reading 'getRange')
    at Cg.getHeredocs (/[REDACTED]/.vscode/extensions/ms-azuretools.vscode-containers-2.4.1/dist/dockerfile-language-server-nodejs/lib/server.js:56:96)
    at Cg.getHeredocs (/[REDACTED]/.vscode/extensions/ms-azuretools.vscode-containers-2.4.1/dist/dockerfile-language-server-nodejs/lib/server.js:76:5086)
    at Validator.getHeredocLines (/[REDACTED]/.vscode/extensions/ms-azuretools.vscode-containers-2.4.1/dist/dockerfile-language-server-nodejs/lib/server.js:91:6128)
    at Validator.validateInstruction (/[REDACTED]/.vscode/extensions/ms-azuretools.vscode-containers-2.4.1/dist/dockerfile-language-server-nodejs/lib/server.js:91:6764)
    at Validator.validate (/[REDACTED]/.vscode/extensions/ms-azuretools.vscode-containers-2.4.1/dist/dockerfile-language-server-nodejs/lib/server.js:91:5631)
    at Object.validate (/[REDACTED]/.vscode/extensions/ms-azuretools.vscode-containers-2.4.1/dist/dockerfile-language-server-nodejs/lib/server.js:91:45615)
    at t.validate (/[REDACTED]/.vscode/extensions/ms-azuretools.vscode-containers-2.4.1/dist/dockerfile-language-server-nodejs/lib/server.js:192:4569)
    at /[REDACTED]/.vscode/extensions/ms-azuretools.vscode-containers-2.4.1/dist/dockerfile-language-server-nodejs/lib/server.js:192:11460

Node.js v22.22.1
[Error - 14:21:46] Server process exited with code 1.
[Error - 14:21:46] The Dockerfile Language Server server crashed 5 times in the last 3 minutes. The server will not be restarted. See the output for more information.

I understand this is due to trailing backslash on the previous line, but ideally extension should be capable of recovering from such failures while developer is removing trailing slash.

At the moment the workaround is to remove trailing slash, then go to Extensions and disable/enable the extension.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the crash with the shown Dockerfile, especially the commented final line and trailing continuation backslash, then trace the Dockerfile Language Server stack shown in the report. Done means the extension no longer exits when the Dockerfile is temporarily invalid and recovers without disabling and re-enabling the extension.

Written by the indexing model from the issue text.

Assessment

Tech stack
docker, typescript, vscode
Domain
developer-experience, tooling
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
55/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.