You’ll have to bare with me here, I am not the SonarQube expert in our team - so I’m probably going to get a lot of things wrong!
So we’re using SonarQube in our CI build in Azure DevOps build pipeline. The project I’m working on is in C#.
When building the solution in the build pipeline, we would usually do an MSBuild, or Visual Studio Build step, but instead we use the SonarQube build wrapper: build-wrapper-win-x86-64.exe. In the log for this step, it says it’s using: Microsoft ® Build Engine version 16.5.0+d4cbfca49 for .NET Framework.
So all our SonarQube analysis works fine and as intended. The issue is that with some specific errors/code-smells, it will run succesfully on the SonarQube build wrapper (but report the issue as an issue/code-smell however), but when running that same commit directly with MSBuild, the build step will fail with the following error for example (if the programmer ignores the code-smell):
Source\SomeCodeProbably\NormalViewModel.cs(230,22): Error CS0414: The field ‘NormalViewModel.disposed’ is assigned but its value is never used
The code runs and compiles fine on the devs local machine (and other machines too!), it passes the SonarQube analysis, but reports it as a code-smell - but it fails when run in an AzureDevops build pipeline directly using MSBuild or the Visual Studio Build step.
It’s worth noting that there are other cases where a developer ignores a code smell and then runs the MSBuild build pipeline, but it passes succesfully, it just seems to be some specific code-smells that brings these failures.
I’m pretty much a complete newbie to SonarQube so if I’ve missed something, or put this in the wrong place, please let me know!
Help is appreciated.