Win32 platform is not supportted for C/C++ Code Analysis using SonarLint in Visual Studio?

  • versions used :
    sonarlint 5.1.0
    visual studio 16.11.7 commuity version
    vscode 1.62.3
    cmake 3.16.4
  • error observed
[CFamily Analysis] Error creating VCX request. File: xxxxx.cpp, Error: System.ArgumentException: Unsupported PlatformName: win32
Argument name: platformName
   at SonarLint.VisualStudio.Integration.Vsix.CFamily.CFamilyHelper.Capture.IsPlatformX64(String platformName)
   at SonarLint.VisualStudio.Integration.Vsix.CFamily.CFamilyHelper.Capture.ToCaptures(IFileConfig fileConfig, String path, String& cfamilyLanguage)
   at SonarLint.VisualStudio.Integration.Vsix.CFamily.VcxProject.VcxRequestFactory.ToRequest(IFileConfig fileConfig, String path)
   at SonarLint.VisualStudio.Integration.Vsix.CFamily.VcxProject.VcxRequestFactory.CreateRequest(String analyzedFilePath, CFamilyAnalyzerOptions analyzerOptions, IFileConfig fileConfig)
   at SonarLint.VisualStudio.Integration.Vsix.CFamily.VcxProject.VcxRequestFactory.TryCreateSync(String analyzedFilePath, CFamilyAnalyzerOptions analyzerOptions)
  • steps to reproduce
1. create a cpp file and write a CMakeLists.txt
2. using cmake to create a solution for vs 32bit x86 toolkits
3. open solution in vs and open cpp file.
4. find error in output panels of sonarlint
  • potential workaround
    64bit solution is fine. but it’s not a workaround, right?

#bug #cpp #help:sl

@Abbas_Sabra could you take a look? Thanks.

1 Like

Hello @samlint,

Thanks for the detailed explanation. I created a ticket to fix this.

The problem is that we are expecting Win32 and you are providing win32.
The default name by VisualStudion is Win32 but since you can generate it from CMake as win32 I created a ticket to support your case.

As a workaround, you can change the CMake generation script to Win32. Assuming you are doing
-A win32 instead of -A Win32.

Thanks,

1 Like

Thank you @Abbas_Sabra, looking forward for the solution.

And we create vs solution/projects within vscode using UI, not by cmd line, so not konw how to change the CMake generation script yet. We can wait and it’s not so urgent for us.

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.