- Operating system: Win 10 21H1 (Build 19043)
- IDE name and flavor/env: Visual Studio Code with PlatformIO
- SonarLint plugin version: 3.4.1
- Is connected mode used: no
I have already opened a ticket on PlatformIO which is my C++ build system because I thought the problem could be located there. As you can see it is not, as the other user can run SonarLint just fine:
It does not matter which project (recently created a new one from scratch), I get the following error from SonarLint:
[Info - 14:47:35.678] Analyzing file 'file:///c:/Users/Inso/Documents/PlatformIO/Projects/Text_SonarLint/src/main.cpp'...
[Info - 14:47:35.684] Index files
[Info - 14:47:35.685] 1 file indexed
[Error - 14:47:35.694] Error executing sensor: 'CFamily'
[Error - 14:47:35.694] java.lang.IllegalStateException: unexpanded response file
The verbose log and compile commands are attached at the end of this reply:
maybe it is more convenient to link them here than to paste all file content.
I now have also tried to install jdk 184.108.40.206 and set it manually within the options, with no success.
while generating the compilation database, can you set it to not use response files? Are you able to generate a compilation database with the response files expanded?
Sorry for my late reply: no, only I can customize is to add the toolchain paths (which I btw just tried to toggle with no success).
PIO Compile Database Options
Hi @Inso ,
I would better check in Support for SonarLint in Visual Studio Code · Issue #4219 · platformio/platformio-core · GitHub why temporary response files end up in the compilation database. It is not a good practice that temporary response files appear in the compilation database as those files may not be available.
I have reported the bug (temporary files showing up in the compile_commands) to platformio, which is fixed in the dev build now. Sadly, Sonarlint still fails.
I have uploaded the output of the debug log and the comilation database. Error itself reads:
[Info - 12:41:55.574] [pool-4-thread-1] Build preamble for C:\Users\Inso\Documents\PlatformIO\Projects\Text_SonarLint\src\main.cpp
[Debug - 12:41:55.574] [pool-4-thread-1] Preamble file: C:\Users\Inso.sonarlint\work.sonartmp_15963293303999009182\9233317015876939718\preamble-file
[stderr] LLVM ERROR: IO failure on output stream: invalid argument
[Error - 12:41:56.821] Exception in thread pool-4-thread-1
[Error - 12:41:56.821] com.sonar.cpp.analyzer.Analyzer$AnalyzerException: Exit code != 0: C:\Users\Inso\Documents\PlatformIO\Projects\Text_SonarLint\src\main.cpp
compile_commands.json (990.0 KB)
Sonarlint Debug Log.txt (33.6 KB)
Hi @Inso ,
could you update to the latest version of SonarLint and then close and reopen vscode (not just reload) and see if you still face the issue and eventually reshare the logs?
In Visual Studio Code it says 3.5.4 is the latest version, which is also the one the logs were made with. If I choose “install anoter version” it says 3.5.4 is actual, three weeks ago. If you want me to install from dev branch, could you provide a link please?
Just for the case I have created another log file from the debug console.
Sonarlint Debug Log 2.txt (26.5 KB)
Hi @Inso ,
could you please try to generate a reproducer file for
C:\Users\Inso\Documents\PlatformIO\Projects\Text_SonarLint\src\main.cpp? It should help us understanding the issue.
You can follow the
Generate the CFamily reproducer File and Report the Issue instructions described here.
files are attached:
log.txt (29.7 KB)
sonar-cfamily.reproducer (2.9 MB)
Thanks for the reproducer.
Before I investigate further, Can you share more information? Does the analysis fail on every file or this specific one? do they all fail with the same error? Do you try to analyze an empty file? A file that includes a simple main function without includes? Also, make sure that you remove the reproducer option when doing the mentioned tests.
I will investigate the reproducer and get back to you.
I was able to reproduce the issue thanks to your reproducer. It impacts specific targets like the one you are using
Here the ticket: [CPP-3748] SonarLint: Fix analysis failure when building the preamble print to the output stream - SonarSource
I will reach out to you once I fix it to test the fix and see if it unblocks you.
The fix is ready, will share it with you privately to confirm that it fixes the issue.
Thanks, @Inso, for confirming privately that the new version solves the issue. The will be released soon and included in SonarLint in a couple of weeks.
This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.