vscode-cmake-tools icon indicating copy to clipboard operation
vscode-cmake-tools copied to clipboard

[Bug] User tasks.json doesn't work anymore

Open tlwetteronline opened this issue 6 months ago • 3 comments

Brief Issue Summary

Tasks defined in ~/.config/Code/User/tasks.json do not work anymore. I only get an infinitely spinning wheel with version 1.21.36. Switching back to 1.20.53, the same task is executed instantly. If I put the task into /.vscode/tasks.json it is also executed instantly (with 1.21.36).

{
    "version": "2.0.0",
    "tasks": [
        {
            "type": "cmake",
            "label": "clean my service",
            "command": "clean",
            "targets": [
                "serviceMain"
            ],
            "problemMatcher": {
                "base": "$gcc",
                "fileLocation": "autoDetect"
            },
            "group": "build",
            "presentation": {
                "panel": "dedicated",
                "clear": true
            }
        }
    ]
}

CMake Tools Diagnostics

{
  "os": "linux",
  "vscodeVersion": "1.103.1",
  "cmtVersion": "1.20.53",
  "configurations": [
    {
      "folder": "/home/torsten.langer/api/services/symbol-maps",
      "cmakeVersion": "3.28.3",
      "configured": true,
      "generator": "Ninja",
      "usesPresets": false,
      "compilers": {
        "C": "/usr/bin/gcc",
        "CXX": "/usr/bin/g++"
      }
    }
  ],
  "cpptoolsIntegration": {
    "isReady": true,
    "hasCodeModel": true,
    "activeBuildType": "Debug",
    "buildTypesSeen": [
      "Debug"
    ],
    "requests": [],
    "responses": [],
    "partialMatches": [],
    "targetCount": 1,
    "executablesCount": 1,
    "librariesCount": 0,
    "targets": [
      {
        "name": "serviceMain",
        "type": "EXECUTABLE"
      }
    ]
  },
  "settings": [
    {
      "communicationMode": "automatic",
      "useCMakePresets": "auto",
      "configureOnOpen": false
    }
  ]
}

Debug Log

Output from CMake/Build:
[proc] Executing command: /usr/bin/cmake --version
[proc] Executing command: /usr/bin/cmake -E capabilities
[kit] Successfully loaded 9 kits from /home/torsten.langer/.local/share/CMakeTools/cmake-tools-kits.json
[variant] Loaded new set of variants
[proc] Executing command: /usr/bin/gcc -v

Output from Extension Host:
2025-08-21 14:53:29.592 [error] TypeError: Cannot read properties of undefined (reading 'path')
    at CustomBuildTaskTerminal.getProject (/home/torsten.langer/.vscode/extensions/ms-vscode.cmake-tools-1.21.36/dist/main.js:87896:80)
    at CustomBuildTaskTerminal.runBuildTask (/home/torsten.langer/.vscode/extensions/ms-vscode.cmake-tools-1.21.36/dist/main.js:87944:34)
    at CustomBuildTaskTerminal.open (/home/torsten.langer/.vscode/extensions/ms-vscode.cmake-tools-1.21.36/dist/main.js:87821:28)
    at _b.startSendingEvents (file:///usr/share/code/resources/app/out/vs/workbench/api/node/extensionHostProcess.js:112:49398)
    at Qy.U (file:///usr/share/code/resources/app/out/vs/workbench/api/node/extensionHostProcess.js:112:53829)
    at Qy.attachPtyToTerminal (file:///usr/share/code/resources/app/out/vs/workbench/api/node/extensionHostProcess.js:112:51873)
    at Yy.$onDidStartTask (file:///usr/share/code/resources/app/out/vs/workbench/api/node/extensionHostProcess.js:121:12554)

Additional Information

No response

tlwetteronline avatar Aug 21 '25 12:08 tlwetteronline

@tlwetteronline Thank you for reporting this issue. We think this issue is the same as this previous one #4529 . Could you please check it? If so, we will duplicate it to issue #4529 . Thank you.

yanghhhhhhh avatar Aug 22 '25 08:08 yanghhhhhhh

@yanghhhhhhh No, #4529 is about problems with tasks in a workspace file, this issue is about tasks in the user tasks file. The effect seems to be similar though and it may have the same root cause but currently, I cannot confirm it.

tlwetteronline avatar Aug 22 '25 08:08 tlwetteronline

Hi @tlwetteronline , thanks for reporting issue. We can reproduced this issue on VS Code 1.102.3 + CMake Tools v1.21.36 release version. Repro Steps:

  1. Create a ~/.config/Code/User/tasks.json file on Linux machine and add the following code.

{ "version": "2.0.0", "tasks": [ { "type": "cmake", "label": "clean my service", "command": "clean", "targets": [ "serviceMain" ], "problemMatcher": { "base": "$gcc", "fileLocation": "autoDetect" }, "group": "build", "presentation": { "panel": "dedicated", "clear": true } } ] }

  1. Create a CMake project, press F1 and click ‘Tasks: Run Task’ > 'clean my service', observe the results.

Details please see following video:

https://github.com/user-attachments/assets/4149b6c4-cad4-48b7-9b58-c4bf5099039b

FYI: @gcampbell-msft

yanghhhhhhh avatar Aug 22 '25 09:08 yanghhhhhhh