microsoft / vscode-cmake-tools

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

Reopen 3797: cmake-tools still does JSON.stringify in 1.19.XX #3982

Closed mortenfc closed 3 months ago

mortenfc commented 3 months ago

before the change (1.18.44):

2024-08-07 17:58:30.458 [error] Error: Extension 'ms-vscode.cmake-tools' CANNOT use API proposal: extensionRuntime.
Its package.json#enabledApiProposals-property declares: [] but NOT extensionRuntime.
 The missing proposal MUST be added and you must start in extension development mode or use the following command line switch: --enable-proposed-api ms-vscode.cmake-tools
    at P (/home/mfjordchris/.vscode-server/bin/b1c0a14de1414fcdaa400695b4db1c0799bc3124/out/vs/workbench/api/node/extensionHostProcess.js:142:59143)
    at get extensionRuntime [as extensionRuntime] (/home/mfjordchris/.vscode-server/bin/b1c0a14de1414fcdaa400695b4db1c0799bc3124/out/vs/workbench/api/node/extensionHostProcess.js:160:12849)
    at JSON.stringify (<anonymous>)
    at RollbarController.exception (/home/mfjordchris/.vscode-server/extensions/ms-vscode.cmake-tools-1.18.44/dist/main.js:95682:60)
    at /home/mfjordchris/.vscode-server/extensions/ms-vscode.cmake-tools-1.18.44/dist/main.js:95726:38

After the change (1.19.37):

2024-08-07 18:00:26.131 [warning] [redhat.java] Accessing a resource scoped configuration without providing a resource is not expected. To get the effective value for '[java]', provide the URI of a resource or 'null' for any resource.
2024-08-07 18:00:28.770 [error] TypeError: Converting circular structure to JSON
    --> starting at object with constructor 'Object'
    |     property 'configurePresets' -> object with constructor 'Array'
    |     index 0 -> object with constructor 'Object'
    --- property '__file' closes the circle
    at JSON.stringify (<anonymous>)
    at RollbarController.exception (/home/mfjordchris/.vscode-server/extensions/ms-vscode.cmake-tools-1.19.37/dist/main.js:113370:60)
    at /home/mfjordchris/.vscode-server/extensions/ms-vscode.cmake-tools-1.19.37/dist/main.js:113414:38

Originally posted by @mortenfc in https://github.com/microsoft/vscode-cmake-tools/issues/3797#issuecomment-2273812301

gcampbell-msft commented 3 months ago

@mortenfc Thanks for the issue, could you try out this vsix (change from .zip to .vsix and install)? cmake-tools.zip

mortenfc commented 3 months ago

Yeah it no longer crashes <3 Just prints the original error in log:

Output -> Cmake/Build:

[cmakefileapi-parser] Read reply folder: <HIDDEN>/.cmake/api/v1/reply
[cmakefileapi-parser] Found index files: [bunch of "*.json",]
[rollbar] Unhandled exception: Unhandled Promise rejection: Post-folder-open Error: No cache object found [object Object]

Output -> Extension Host (Remote) :

2024-08-13 20:09:50.658 [info] ExtensionService#_doActivateExtension ms-vscode.cmake-tools, startup: true, activationEvent: 'workspaceContains:CMakeLists.txt'

Also tried updating the extension to make sure I installed it correctly and it fixed the crash:

Output -> Extension Host (Remote) :

2024-08-13 20:15:32.023 [error] TypeError: Converting circular structure to JSON
    --> starting at object with constructor 'Object'
    |     property 'configurePresets' -> object with constructor 'Array'
    |     index 0 -> object with constructor 'Object'
    --- property '__file' closes the circle
    at JSON.stringify (<anonymous>)
    at RollbarController.exception (/home/mfjordchris/.vscode-server/extensions/ms-vscode.cmake-tools-1.19.38/dist/main.js:113371:60)
    at /home/mfjordchris/.vscode-server/extensions/ms-vscode.cmake-tools-1.19.38/dist/main.js:113415:38
mortenfc commented 3 months ago

BTW I have these settings for it:

  // CMAKE settings
  "cmake.ctest.allowParallelJobs": true,
  "cmake.ctest.parallelJobs": 16,
  "cmake.loggingLevel": "debug",
  "cmake.enableTraceLogging": true,
  "cmake.exportCompileCommandsFile": true,
  "cmake.loadCompileCommands": true,
  "cmake.configureOnEdit": false,
  "cmake.configureOnOpen": true,
  "cmake.parallelJobs": 16,
  "cmake.buildArgs": [
    "--parallel 16"
  ],
  "cmake.pinnedCommands": [
    "workbench.action.tasks.configureTaskRunner",
    "workbench.action.tasks.runTask"
  ],
  "cmake.showOptionsMovedNotification": false,
  "cmake.options.statusBarVisibility": "hidden",
  "cmake.options.advanced": {
    "buildTarget": {
      "statusBarVisibility": "visible"
    },
  },
  "cmake.showConfigureWithDebuggerNotification": false,
  "cmake.automaticReconfigure": true,
  "cmake.useCMakePresets": "always",
mortenfc commented 3 months ago

Wait I tried installing the .vsix again, now the error is in Extension Host (Remote) window instead:

2024-08-13 20:18:32.129 [error] Error: No cache object found
    at CMakeFileApiDriver.updateCodeModel (/home/mfjordchris/.vscode-server/extensions/ms-vscode.cmake-tools-1.13.0/dist/main.js:100232:23)
    at async CMakeFileApiDriver.doInit (/home/mfjordchris/.vscode-server/extensions/ms-vscode.cmake-tools-1.13.0/dist/main.js:100046:38)
    at async CMakeFileApiDriver._baseInit (/home/mfjordchris/.vscode-server/extensions/ms-vscode.cmake-tools-1.13.0/dist/main.js:99604:9)
    at async CMakeFileApiDriver.createDerived (/home/mfjordchris/.vscode-server/extensions/ms-vscode.cmake-tools-1.13.0/dist/main.js:99611:9)
    at async CMakeProject.startNewCMakeDriver (/home/mfjordchris/.vscode-server/extensions/ms-vscode.cmake-tools-1.13.0/dist/main.js:89126:27)
    at async /home/mfjordchris/.vscode-server/extensions/ms-vscode.cmake-tools-1.13.0/dist/main.js:89392:21
    at async /home/mfjordchris/.vscode-server/extensions/ms-vscode.cmake-tools-1.13.0/dist/main.js:114702:36
2024-08-13 20:18:34.187 [error] Error: No cache object found
    at CMakeFileApiDriver.updateCodeModel (/home/mfjordchris/.vscode-server/extensions/ms-vscode.cmake-tools-1.13.0/dist/main.js:100232:23)
    at async CMakeFileApiDriver.doInit (/home/mfjordchris/.vscode-server/extensions/ms-vscode.cmake-tools-1.13.0/dist/main.js:100046:38)
    at async CMakeFileApiDriver._baseInit (/home/mfjordchris/.vscode-server/extensions/ms-vscode.cmake-tools-1.13.0/dist/main.js:99604:9)
    at async CMakeFileApiDriver.createDerived (/home/mfjordchris/.vscode-server/extensions/ms-vscode.cmake-tools-1.13.0/dist/main.js:99611:9)
    at async CMakeProject.startNewCMakeDriver (/home/mfjordchris/.vscode-server/extensions/ms-vscode.cmake-tools-1.13.0/dist/main.js:89126:27)
    at async /home/mfjordchris/.vscode-server/extensions/ms-vscode.cmake-tools-1.13.0/dist/main.js:89392:21
    at async /home/mfjordchris/.vscode-server/extensions/ms-vscode.cmake-tools-1.13.0/dist/main.js:114702:36
2024-08-13 20:18:37.748 [error] Error: No cache object found
    at CMakeFileApiDriver.updateCodeModel (/home/mfjordchris/.vscode-server/extensions/ms-vscode.cmake-tools-1.13.0/dist/main.js:100232:23)
    at async CMakeFileApiDriver.doInit (/home/mfjordchris/.vscode-server/extensions/ms-vscode.cmake-tools-1.13.0/dist/main.js:100046:38)
    at async CMakeFileApiDriver._baseInit (/home/mfjordchris/.vscode-server/extensions/ms-vscode.cmake-tools-1.13.0/dist/main.js:99604:9)
    at async CMakeFileApiDriver.createDerived (/home/mfjordchris/.vscode-server/extensions/ms-vscode.cmake-tools-1.13.0/dist/main.js:99611:9)
    at async CMakeProject.startNewCMakeDriver (/home/mfjordchris/.vscode-server/extensions/ms-vscode.cmake-tools-1.13.0/dist/main.js:89126:27)
    at async /home/mfjordchris/.vscode-server/extensions/ms-vscode.cmake-tools-1.13.0/dist/main.js:89392:21
    at async /home/mfjordchris/.vscode-server/extensions/ms-vscode.cmake-tools-1.13.0/dist/main.js:114702:36

image

gcampbell-msft commented 3 months ago

@mortenfc I'm not sure I fully understand, so you're saying that the stringify issue is solved, but then you're seeing other errors?

Looking at the code, we throw the error "No cache object found" when we don't find the cache in the cmake fileAPI response. Have you tried running "CMake: Delete Cache and Reconfigure"? Or even deleting your whole build folder and reconfiguring? This issue doesn't feel related to the rollbar

mortenfc commented 3 months ago

Yes, I got that error instead. I no longer get it after I built a few times. Uncaught errors seem bad, though.

"No cache object found" was the pop up message in the initial ticket, probably caused by the JSON.stringify extension runtime thing

2024-05-29 10:32:12.193 [error] Error: Extension 'ms-vscode.cmake-tools' CANNOT use API proposal: extensionRuntime.
Its package.json#enabledApiProposals-property declares: [] but NOT extensionRuntime.
 The missing proposal MUST be added and you must start in extension development mode or use the following command line switch: --enable-proposed-api ms-vscode.cmake-tools
    at y (/home/mfjordchris/.vscode-server/bin/dc96b837cf6bb4af9cd736aa3af08cf8279f7685/out/vs/workbench/api/node/extensionHostProcess.js:143:51558)
    at get extensionRuntime [as extensionRuntime] (/home/mfjordchris/.vscode-server/bin/dc96b837cf6bb4af9cd736aa3af08cf8279f7685/out/vs/workbench/api/node/extensionHostProcess.js:161:12748)
    at JSON.stringify (<anonymous>)

After install .vsix, it's no longer a pop up, just an error message in Output > Extension Host OR Cmake/Build

mortenfc commented 3 months ago

It's maybe not a popup because I Set these

"cmake.showOptionsMovedNotification": false, "cmake.showConfigureWithDebuggerNotification": false,

gcampbell-msft commented 3 months ago

@mortenfc Those settings are unrelated to this.

To summarize what I think I'm understanding is that, yes, we should likely create a separate bug to handle any uncaught errors, but for this one, it sounds like it will be resolved with #3985, as it fixes the crashing issue. Would that be correct?

mortenfc commented 3 months ago

I don't know, I just know that the .zip you attached to this issue solved the Stringify problem.

gcampbell-msft commented 3 months ago

I don't know, I just know that the .zip you attached to this issue solved the Stringify problem.

Perfect, that PR I linked is the change I built into that .zip file.

Evelyn-001 commented 3 months ago

@gcampbell-msft, according the customer's latest comment, The .zip you attached to this issue solved the Stringify problem. Cold we close this issue now? Thank in advance.