microsoft / microsoft/vscode-cmake-tools

[Bug] Task defined inside workspace file can not be run, it is stuck in "Task is running" state.

Open
#4,529 6 comments 0 reactions 1 assignee View on GitHub

Nobody has claimed this yet.

bug
Dominant language
TypeScript
Stars
1.7k
Forks
546
Avg merge
2d 16h
Merged PRs (30d)
32

Description

### Brief Issue Summary

If the task is defined in workspace file, it is stuck with error:
```
[error] TypeError: Cannot read properties of undefined (reading 'path')
at CustomBuildTaskTerminal.getProject (\.vscode\extensions\ms-vscode.cmake-tools-1.21.36\dist\main.js:87896:80)

```
Seems the problem with workspaceFolder.uri. The task example:
<...>.code-workspace:
```
{
"launch": {
"version": "0.2.0",
"configurations": [
<...>
],
},
"tasks": {
"version": "2.0.0",
"tasks": [
{
"type": "cmake",
"label": "Prelaunch Build",
"command": "build",
"targets": [
"all"
],
}
]
},
"folders": [
{
"path": "."
}
],
}
```

If the task is replaced into tasks.json, the workspace folder is recognized and everything works correctly

### CMake Tools Diagnostics

```shell
{
"os": "win32",
"vscodeVersion": "1.95.3",
"cmtVersion": "1.22.2",
"configurations": [
{
"folder": "<>",
"cmakeVersion": "3.26.4",
"configured": true,
"generator": "Ninja",
"usesPresets": false,
"compilers": {}
}
],
"cpptoolsIntegration": {
"isReady": true,
"hasCodeModel": true,
"activeBuildType": "Debug",
"buildTypesSeen": [
"Debug"
],
"requests": [],
"responses": [],
"partialMatches": [],
"targetCount": 1,
"executablesCount": 1,
"librariesCount": 0,
"targets": [
{
"name": "main",
"type": "EXECUTABLE"
}
]
},
"settings": [
{
"communicationMode": "automatic",
"useCMakePresets": "auto",
"configureOnOpen": true
}
]
}
```

### Debug Log

```shell
ExtensionHost window (output window is empty):
[error] TypeError: Cannot read properties of undefined (reading 'path')
at CustomBuildTaskTerminal.getProject (<>\.vscode\extensions\ms-vscode.cmake-tools-1.22.2\dist\main.js:87966:80)
at CustomBuildTaskTerminal.runBuildTask (<>\.vscode\extensions\ms-vscode.cmake-tools-1.22.2\dist\main.js:88014:34)
at CustomBuildTaskTerminal.open (<>\.vscode\extensions\ms-vscode.cmake-tools-1.22.2\dist\main.js:87876:28)
at X0.startSendingEvents (file:///<>/AppData/Local/Programs/Microsoft%20VS%20Code/resources/app/out/vs/workbench/api/node/extensionHostProcess.js:114:40456)
at Jw.S (file:///<>/AppData/Local/Programs/Microsoft%20VS%20Code/resources/app/out/vs/workbench/api/node/extensionHostProcess.js:114:44872)
at Jw.attachPtyToTerminal (file:///<>/AppData/Local/Programs/Microsoft%20VS%20Code/resources/app/out/vs/workbench/api/node/extensionHostProcess.js:114:42916)
at Qw.$onDidStartTask (file:///<>/AppData/Local/Programs/Microsoft%20VS%20Code/resources/app/out/vs/workbench/api/node/extensionHostProcess.js:121:52658)
```

### Additional Information

_No response_

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.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.