Failed to execute analysis SonarLint Visual Studio 2017

  • Issues with:
  • SonarLint for Viusual Studio 2017 Version: 4.22.0.18519
  • Visual Studio 2017 Version 15.9.21

I recently migrated our enterprise solution from Visual Studio 2012 to Visual Studio 2017, so we could start using SonarLint connected to our SonarQube server. After installing the extension from the marketplace, and completing the installation, when opening a file and the analysis begins, the following stacktrace is shown:

Using cached rule settings
Analyzing C:\git\VS2017\xxx\yyy\vvv\ttt\sss\aaa\bbb\ccc\_Source\fileIWantToAnalyse.cpp
Failed to execute analysis, exception details: System.ArgumentException: The path is not of a legal form.
   at System.IO.Path.LegacyNormalizePath(String path, Boolean fullCheck, Int32 maxPathLength, Boolean expandShortPaths)
   at System.IO.Path.NormalizePath(String path, Boolean fullCheck, Int32 maxPathLength, Boolean expandShortPaths)
   at System.IO.Path.GetFullPathInternal(String path)
   at SonarLint.VisualStudio.Integration.Vsix.CFamily.Protocol.Read(BinaryReader reader, String issueFilePath)
   at SonarLint.VisualStudio.Integration.Vsix.CFamily.CFamilyHelper.CallClangAnalyzer(Request request, IProcessRunner runner, ILogger logger, CancellationToken cancellationToken)

So we have no analysis being performed. What can I do to fix this for our team?

Hi @Bernold1, welcome to the community.

Thanks for reporting this issue to us.

The stack trace looks very similar to another issue we have; would you mind taking a look at it and reporting if that’s the problem you’re having?

Thanks for the response @rita.g. Seems about right, did not have any luck with the given workaround. Just tested this with Visual Studio 2019 using the same project, where it is giving the same issues. What exactly is needed to fix the problem?

@Bernold1 for the file that you’re analyzing: are you using “additional options”? and are any of them in quotations?
If so, then that’s the problem, please try to define them without quotations.

@rita.g we have give or take 50+ projects in the solution, but upon inspecting as many projects as I could, none of them contain any preprocessor definitions. So this might not be the same issue.

Thanks @Bernold1. Can you please try to follow the instructions in our troubleshooting guide, and share with me the “reproducer” file (either here or in a private message)?

Btw, you don’t have to go over the projects in your solution: you can right click on the cpp file you wish to analyze and go to Properties —> C/C++ —> Command Line. If you have additional options, you should see them at the bottom panel.

Hi @rita.g, can you provide some contact info?

Yeah I have been doing that as well, but thank you for the suggestion. :smiley:

We’ve identified the root cause and have opened an issue. Thanks @Bernold1 for bringing this to our attention :slight_smile: