Most of the operations with CMake Tools fail with unhandled exception errors.
When I just open any CMake project in Visual Studio Code, I immediately get the following error in the output:
[rollbar] Unhandled exception: Error during CMake upgrade TypeError: Cannot read property '1' of null {"version":"3.13.2","linuxURL":"https://github.com/Kitware/CMake/releases/download/v3.13.2/cmake-3.13.2-Linux-x86_64.sh","windowsURL":"https://github.com/Kitware/CMake/releases/download/v3.13.2/cmake-3.13.2-win64-x64.msi"}
And if I try to run CMake: Configure, then I get this error in the output:
[rollbar] Unhandled exception: Unhandled Promise rejection: configure TypeError: Cannot read property '1' of null {}
[2019-08-14 10:02:51.391] [exthost] [info] extension host started
[2019-08-14 10:02:51.405] [exthost] [info] ExtensionService#_doActivateExtension mitaki28.vscode-clang {"startup":false,"activationEvent":"onLanguage:cpp"}
[2019-08-14 10:02:51.406] [exthost] [info] ExtensionService#loadCommonJSModule C:\Users\username\.vscode\extensions\mitaki28.vscode-clang-0.2.3\out\src\extension
[2019-08-14 10:02:51.411] [exthost] [info] ExtensionService#_doActivateExtension ms-vscode.cpptools {"startup":false,"activationEvent":"onLanguage:cpp"}
[2019-08-14 10:02:51.411] [exthost] [info] ExtensionService#loadCommonJSModule C:\Users\username\.vscode\extensions\ms-vscode.cpptools-0.24.1\dist\main
[2019-08-14 10:02:51.427] [exthost] [info] ExtensionService#_doActivateExtension vscode.debug-auto-launch {"startup":true,"activationEvent":"*"}
[2019-08-14 10:02:51.427] [exthost] [info] ExtensionService#loadCommonJSModule e:\tools\vsc\resources\app\extensions\debug-auto-launch\dist\extension
[2019-08-14 10:02:51.428] [exthost] [info] ExtensionService#_doActivateExtension vscode.emmet {"startup":true,"activationEvent":"*"}
[2019-08-14 10:02:51.428] [exthost] [info] ExtensionService#loadCommonJSModule e:\tools\vsc\resources\app\extensions\emmet\dist\extension
[2019-08-14 10:02:51.434] [exthost] [info] ExtensionService#_doActivateExtension vscode.git {"startup":true,"activationEvent":"*"}
[2019-08-14 10:02:51.434] [exthost] [info] ExtensionService#loadCommonJSModule e:\tools\vsc\resources\app\extensions\git\dist\main
[2019-08-14 10:02:51.445] [exthost] [info] ExtensionService#_doActivateExtension vscode.merge-conflict {"startup":true,"activationEvent":"*"}
[2019-08-14 10:02:51.445] [exthost] [info] ExtensionService#loadCommonJSModule e:\tools\vsc\resources\app\extensions\merge-conflict\dist\extension
[2019-08-14 10:02:51.447] [exthost] [info] ExtensionService#_doActivateExtension vincaslt.highlight-matching-tag {"startup":true,"activationEvent":"*"}
[2019-08-14 10:02:51.447] [exthost] [info] ExtensionService#loadCommonJSModule C:\Users\username\.vscode\extensions\vincaslt.highlight-matching-tag-0.9.3\out\src\extension
[2019-08-14 10:02:51.454] [exthost] [info] ExtensionService#_doActivateExtension vector-of-bool.cmake-tools {"startup":true,"activationEvent":"workspaceContains:CMakeLists.txt"}
[2019-08-14 10:02:51.454] [exthost] [info] ExtensionService#loadCommonJSModule C:\Users\username\.vscode\extensions\vector-of-bool.cmake-tools-1.1.3\out\src\extension
[2019-08-14 10:02:51.594] [exthost] [error] ProxyResolver#getCertificates (intermediate value) is not a function
[2019-08-14 10:02:51.676] [exthost] [info] eager extensions activated
[2019-08-14 10:02:52.642] [exthost] [info] ExtensionService#_doActivateExtension vscode.configuration-editing {"startup":false,"activationEvent":"onLanguage:json"}
[2019-08-14 10:02:52.642] [exthost] [info] ExtensionService#loadCommonJSModule e:\tools\vsc\resources\app\extensions\configuration-editing\dist\extension
[2019-08-14 10:02:52.644] [exthost] [info] ExtensionService#_doActivateExtension vscode.extension-editing {"startup":false,"activationEvent":"onLanguage:json"}
[2019-08-14 10:02:52.644] [exthost] [info] ExtensionService#loadCommonJSModule e:\tools\vsc\resources\app\extensions\extension-editing\dist\extension
[2019-08-14 10:02:52.648] [exthost] [info] ExtensionService#_doActivateExtension vscode.json-language-features {"startup":false,"activationEvent":"onLanguage:json"}
[2019-08-14 10:02:52.648] [exthost] [info] ExtensionService#loadCommonJSModule e:\tools\vsc\resources\app\extensions\json-language-features\client\dist\jsonMain
[2019-08-14 10:02:52.655] [exthost] [info] ExtensionService#_doActivateExtension vscode.npm {"startup":false,"activationEvent":"onLanguage:json"}
[2019-08-14 10:02:52.655] [exthost] [info] ExtensionService#loadCommonJSModule e:\tools\vsc\resources\app\extensions\npm\dist\main
It started happening all of the sudden. One minute it was all good, and then suddenly I started getting these errors. And I cannot recall any changes done to the system which could cause it.
Already tried deleting both CMake Tools and Visual Studio Code and installing them again.
I have also tried to reproduce it in the virtual machine with all the same tools and versions installed - there it all works just fine.
The first one is harmless since the upgrade doesn't happen on Windows, but the second one is definitely a problem.
When you deleted CMake Tools, did you uninstall it via VS Code, or did you manually delete the %userprofile%\.vscode\extensions\vector-of-bool.cmake-tools-1.1.3 folder? VS Code doesn't instantly delete extensions all of the time, so there's a possibility that your uninstall of the extension didn't have the effect you wanted.
It's not otherwise obvious what may be causing this, so if manually deleting the folder and reinstalling doesn't fix it, can you try changing your logging settings to get more information for us? Try "cmake.loggingLevel": "debug".
I've just removed the extension from VS Code, closed VS Code, moved the vector-of-bool.cmake-tools-1.1.3 folder to another place, launched VS Code and installed the extensions again. Unfortunately, that didn't help.
Then I've set logging to the debug level. Here's a the output I get right after opening a project:
[rollbar] Updated Rollbar payload {"environment":"production","packageJSON":{"name":"cmake-tools","version":"1.1.3"},"client":{"code_version":"1.1.3"},"platform":"win32"}
[kit] Reading kits file C:\Users\username\AppData\Local\CMakeTools\cmake-tools-kits.json
[kit] Not reading non-existent kits file: e:\code\some-project\.vscode\cmake-kits.json
[kit] Successfully loaded 13 kits from C:\Users\username\AppData\Local\CMakeTools\cmake-tools-kits.json
[main] Safe constructing new CMakeTools instance
[variant] Constructing VariantManager
[main] Constructing new CMakeTools instance
[main] Starting CMakeTools second-phase init
[rollbar] Checking Rollbar permissions
[rollbar] Rollbar enabled? false
[variant] Loaded new set of variants
[main] CMakeTools instance initialization complete.
[main] Injecting new Kit into CMake driver
[kit] Reading kits file C:\Users\username\AppData\Local\CMakeTools\cmake-tools-kits.json
[kit] Successfully loaded 13 kits from C:\Users\username\AppData\Local\CMakeTools\cmake-tools-kits.json
[kit] Not reading non-existent kits file: e:\code\some-project\.vscode\cmake-kits.json
[rollbar] Updated Rollbar payload {"kit":{"name":"Visual Studio Professional�2019 - amd64","visualStudio":"VisualStudio.16.0","visualStudioArchitecture":"amd64"}}
[main] Injecting new Kit into CMake driver
[rollbar] Unhandled exception: Error during CMake upgrade TypeError: Cannot read property '1' of null {"version":"3.13.2","linuxURL":"https://github.com/Kitware/CMake/releases/download/v3.13.2/cmake-3.13.2-Linux-x86_64.sh","windowsURL":"https://github.com/Kitware/CMake/releases/download/v3.13.2/cmake-3.13.2-win64-x64.msi"}
And here's what I get after running CMake: Configure:
[rollbar] Unhandled exception: Unhandled Promise rejection: configure TypeError: Cannot read property '1' of null {}
Regarding
The first one is harmless since the upgrade doesn't happen on Windows
it is still weird because I never got this error before. It is also strange to see CMake 3.13.2 being mentioned here, because I have 3.15.2 installed.
Found the reason, it's my bad.
I looked at my global settings.json and discovered that cmake.cmakePath is set to Ninja. The thing is, rather often I need to switch between CMake generators, which is controlled by cmake.generator setting, and apparently one of those times I've set the wrong setting.
So changing cmake.cmakePath back to the correct CMake path fixed the issue.
Sorry for wasting your time.
No worries. I had just finished digging through the code and was about to suggest a method to get the callstack. My testing had gotten me to the point where I suspected something wrong with the extension finding CMake, but I was going to follow up with you today on it. Either way, I think this is helpful for us to know because we should put a better error message there. I'm going to repurpose this issue to add a better message.
This issue has been addressed in CMake Tools 1.2.0 which is available in the VS Code Marketplace or on the Releases Page
Because the publisher id has changed, VS Code does not automatically upgrade you yet. The Marketplace team will enable this in the next few days. If you want to install 1.2.0 now, please make sure you uninstall any earlier versions of CMake Tools manually to avoid any conflicts.