microsoft / microsoft/vscode-cpptools
Run Task Freezes for some Variable References
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 6.2k
- Forks
- 1.7k
- Avg merge
- 14h 46m
- Merged PRs (30d)
- 61
Description
Discussed in https://github.com/microsoft/vscode-cpptools/discussions/10686
Originally posted by shengchao-lin March 15, 2023
When variable reference is used that relates to the current file, e.g., ${file}, ${fileBasename}, etc, the run task freezes. However, a simple echo does not. See the example below. Task "My C++ build" hangs but "echo" does not.
When freezing, the terminal tab shows:

If task "echo" is ran first, launched the terminal tab, and ran successfully, then task "My C++ build" can ran successfully too.
Additionally, when the "${workspaceFolder}/${fileBasename}" is replaced with something like "${workspaceFolder}/main.cpp", the task "My C++ build" runs successfully.
What could be the issue here?
"tasks": [
{
"type": "cppbuild",
"label": "build",
"command": "g++",
"args": [
"-fdiagnostics-color=always",
"-g",
"${workspaceFolder}/${fileBasename}",
"-o",
"${workspaceFolder}/output",
"-std=c++20"
],
"detail": "compiler: /usr/bin/g++",
"group": {
"kind": "build",
"isDefault": true
}
},
{
"type": "shell",
"label": "echo",
"command": "echo ${workspaceFolder}/${fileBasename}",
}
]
Platform: MacOS Ventura 13.2.1
VSCODE:
Version: 1.76.2
Commit: ee2b180d582a7f601fa6ecfdad8d9fd269ab1884
Date: 2023-03-14T17:54:09.061Z
Electron: 19.1.11
Chromium: 102.0.5005.196
Node.js: 16.14.2
V8: 10.2.154.26-electron.0
OS: Darwin x64 22.3.0
Sandboxed: No
Extension used: C/C++
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the linked discussion and reproduce the task configuration using ${workspaceFolder}/${fileBasename} versus a literal filename. Compare the freezing C++ build task with the working echo task, and verify that the task completes reliably on the reported macOS and VS Code versions.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp, vscode
- Domain
- build-system, devtools
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100