Parsing of cmake-kits.json fails regularly
See original GitHub issueBrief Issue Summary
Quite often I get the error message [kit] Failed to parse cmake-kits.json: {1}
when changing the cmake-kits.json
file. After saving the file a few times (without modifications) parsing will succeed.
Sometimes this also seems to happen on start of VSCode.
Expected:
Consistent behavior if cmake-kits.json
does not change. In the example below I’d expect the parsing of the file to succeed all the time.
CMake Tools Log
Log from saving a few times, cmake.loggingLevel
is at trace
.
[kit] Reading kits file c:\work\git\poquid\.vscode\cmake-kits.json
[kit] Failed to parse cmake-kits.json: {1}
[kit] Reading kits file c:\work\git\poquid\.vscode\cmake-kits.json
[kit] Failed to parse cmake-kits.json: {1}
[kit] Reading kits file c:\work\git\poquid\.vscode\cmake-kits.json
[kit] Successfully loaded 2 kits from c:\work\git\poquid\.vscode\cmake-kits.json
[kit] Reading kits file c:\work\git\poquid\.vscode\cmake-kits.json
[kit] Successfully loaded 2 kits from c:\work\git\poquid\.vscode\cmake-kits.json
Platform and Versions
- Operating System: Windows 10
- CMake Version: 3.15.1
- VSCode Version: 1.45.0-insider
- CMake Tools Extension Version: 1.3.1
- Compiler/Toolchain: Keil ARMClang & Keil ARMCC with custom toolchain file
Other Notes/Information
cmake-kits.json
being used (with minor modifications to my productive one, but the same issue can be observed here):
[
{
"name": "Keil armclang Chip1",
"toolchainFile": "C:/work/git/cmake-keil/toolchain-keil-armclang.cmake",
"cmakeSettings": {
"TOOLCHAIN_PATH": "C:/ToolsRep",
"DERIVATIVE": "Chip1",
"LIB_PATH": "../lib"
}
},
{
"name": "Keil armcc Chip1",
"toolchainFile": "C:/work/git/cmake-keil/toolchain-keil-armcc.cmake",
"cmakeSettings": {
"TOOLCHAIN_PATH": "C:/ToolsRep",
"DERIVATIVE": "Chip1",
"LIB_PATH": "../lib"
}
}
]
I know that the provided log is most likely quite insufficient to debug the issue. If there is any way I can provide additional information I’d be happy to do so.
Issue Analytics
- State:
- Created 3 years ago
- Reactions:3
- Comments:14 (6 by maintainers)
Top Results From Across the Web
vscode-cmake-tools/support - Gitter
I have error: Unable to determine what CMake generator to use. Please install or configure a preferred generator, or update settings.json, your Kit ......
Read more >CMake server json parse error. - Visual Studio Feedback
A not too compicated CMake project fails to configure due to json parse errors. It is a project of mine found on github....
Read more >vscode-cmake-tools - Bountysource
I have a test project using CMake. It builds fine if there is no CMakePresets.json file in the directory. But if the file...
Read more >CMake Kits — CMake Tools 1.4.0 documentation
The .vscode/cmake-kits.json file can be committed to source control and shared ... about the compiler binary names and how to parse its version...
Read more >Time Tracking Report - Qt Bug Tracker
Bug, QTCREATORBUG-27179, Closed, Not Evaluated, qml2puppet fails to build if quick3d is present ... Not Evaluated, encode settings key in json kit files....
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I did some additional checking, and as could be guesses from the exception it seems that the issue occurs during reading of the file, not the parsing. I added an additional output in the error case to dump the read file content:
Testing with a cmake-kits.json just containing
[]
I can see that thecontent_str
is empty.I’ve not seen a case where only part of the file was read, always either all or nothing (also with bigger files). Just a wild guess: could it be that it’s reading the file in a state where the new content was not yet written? (assuming the write is not atomic)
cmake-kits.json vs user level cmake-tools-kits.json: The issue occurs for the user-level file as well, it seems to be more infrequent though.
Repro I’d be happy to provide a repository, but after the check of the user-level file I’m not sure that would help… I can reproduce the issue by opening a new workspace and placing a
.vscode/cmake-kits.json
file containing[]
into it. Then I just repeatedly save the file. If you think it help I’d not have a problem generating that. Or just save the user-level kits file repeatedly.same issue here, deactivating Windows Defender does not help. (Working on a M2 SSD)