microsoft/azure-pipelines-vscode

Extension crashes when `${{ insert }}` is the first element in a list

dagood opened this issue · 2 comments

I tried installing this extension in an existing project with some reasonably complex templates, and found a crash when opening a file with this particular pattern. I was able to get it down to a small repro:

  1. In a fresh VS Code window, create a doc with this content:
- ${{ each value in parameters.thing }}:
  - ${{ insert }}: ${{ value }}
  1. Switch the file type to Azure Pipelines.

After that, the extension loads and eventually shows this error in the extension's output window:

c:\Users\dagood\.vscode\extensions\ms-azure-devops.azure-pipelines-1.208.0\dist\server.js:1925
                    throw new Error("Unexpected kind " + value.kind);
                    ^

Error: Unexpected kind 0
    at addItemsToArrayNode (c:\Users\dagood\.vscode\extensions\ms-azure-devops.azure-pipelines-1.208.0\dist\server.js:1925:27)
    at addItemsToArrayNode (c:\Users\dagood\.vscode\extensions\ms-azure-devops.azure-pipelines-1.208.0\dist\server.js:1911:21)
    at recursivelyBuildAst (c:\Users\dagood\.vscode\extensions\ms-azure-devops.azure-pipelines-1.208.0\dist\server.js:1814:13)
    at createJSONDocument (c:\Users\dagood\.vscode\extensions\ms-azure-devops.azure-pipelines-1.208.0\dist\server.js:1942:17)
    at c:\Users\dagood\.vscode\extensions\ms-azure-devops.azure-pipelines-1.208.0\dist\server.js:1992:66
    at Array.map (<anonymous>)
    at parse (c:\Users\dagood\.vscode\extensions\ms-azure-devops.azure-pipelines-1.208.0\dist\server.js:1992:38)
    at validateTextDocument (c:\Users\dagood\.vscode\extensions\ms-azure-devops.azure-pipelines-1.208.0\dist\server.js:344:69)
    at Timeout._onTimeout (c:\Users\dagood\.vscode\extensions\ms-azure-devops.azure-pipelines-1.208.0\dist\server.js:333:9)
    at listOnTimeout (node:internal/timers:557:17)

The error repeats 5 times and I get this notification:

The Azure Pipelines Language server crashed 5 times in the last 3 minutes. The server will not be restarted.

Version 1.208.0

Hi @dagood!
Thanks for your request, seems like the problem is in - ${{ script }} key and even if it's not possible to parse the script, the extension should not close the connection.
We've added this feature request to our backlog. We'll take a look at it once we have enough capacity. Thank you again!

50Wliu commented

This no longer reproes on 1.228.0, assuming that the latest batch of language server changes have also fixed this one :).