microsoft / vscode-cmake-tools

CMake integration in Visual Studio Code
https://marketplace.visualstudio.com/items?itemName=vector-of-bool.cmake-tools
MIT License
1.47k stars 454 forks source link

No cache object found at startup #4066

Open gserm opened 1 month ago

gserm commented 1 month ago

Brief Issue Summary

I have a project with cmake presets. Starting with a clean slate (before any configuration or preset selection in vscode), use a terminal to create a client stateless query under the build directory of a given preset mkdir -p </path/to/build/folder>/.cmake/api/v1/query/client-foo/ touch </path/to/build/folder>/.cmake/api/v1/query/client-foo/codemodel-v2 and then configure the project cmake --preset <preset> -B </path/to/build/folder> As expected, at the end of the configuration CMake will have generated certain reply files under </path/to/build/folder>/.cmake/api/v1/reply. Now launch vscode, open the project and select the same preset as above, you'll see the following message: [rollbar] Unhandled exception: Unhandled Promise rejection: Post-folder-open Error: No cache object found [object Object] At that point, the cmake tools extension doesn't display any items.

The issue seems similar to https://github.com/microsoft/vscode-cmake-tools/issues/2882

CMake Tools Diagnostics

{
  "os": "darwin",
  "vscodeVersion": "1.93.1",
  "cmtVersion": "1.19.51",
  "configurations": [
    {
      "folder": "/Users/gsr68/Source/QtApp",
      "cmakeVersion": "unknown",
      "configured": false,
      "generator": "unknown",
      "usesPresets": false,
      "compilers": {}
    }
  ],
  "cpptoolsIntegration": {
    "isReady": false,
    "hasCodeModel": false,
    "activeBuildType": "",
    "buildTypesSeen": [],
    "requests": [],
    "responses": [],
    "partialMatches": [],
    "targetCount": 0,
    "executablesCount": 0,
    "librariesCount": 0,
    "targets": []
  },
  "settings": [
    {
      "communicationMode": "automatic",
      "useCMakePresets": "auto",
      "configureOnOpen": true
    }
  ]
}

Debug Log

No response

Additional Information

No response

Amy-Li03 commented 1 month ago

I'm sorry that you are encountering this issue, could you please try following steps to troubleshoot the issue:

  1. Check if you have any other extensions installed, if yes, please try disabling them temporarily to see if the error persists.

  2. You can try deleting cache-related files VS code might be using:

  1. Check the settings.json for any caching-related configurations.
  2. Set the cmake.loggingLevel to "debug" and look for "Failed writing to file" in the Output Window.