Hello please find the information regarding our system:
We are using SonarQube 9.9 and Sonarscanner for .net fw 5.11
SonarQube is deployed using zip
Recently SonarQube marked all the code smells with if…elseif(C# static code analysis: "if ... else if" constructs should end with "else" clauses) rule as fixed without any code change. We tried activating and reactivating that rule but that didn’t help. Please let me know how to fix this. If you need any logs , i would prefer to send them privately.
One more question: which version of MSBuild do you use to build your projects?
You should be able to see this in the build logs right at the beginning of the build.
If you use MSBuild.exe to build your project you should see in the beginning of the logs: Microsoft (R) Build Engine version x.x.x. for .NET Framework
If you use the dotnet CLI: MSBuild version x.x.x.x for .NET
Would it be possible to use any MSBuild version before this and tell me if the issues re-appear? That’s what happened to me when I managed to reproduce your issue.
I will give it a try and let you know. I think this issue happened when we updated our build systems to 17.5 version so most probably this will fix the issue. But I would like to know if there’s a way to have latest MSBuild version and still fix this issue somehow?
We are still investigating on our side, and so far the issue seems to be on MSBuild (in the new Roslyn version) and not in one of our products (which means that we should potentially report the bug and wait for a fix on the Microsoft side to use the latest MSBuild version).
I will let you know soon.
Thanks for that. We were starting to see the same behavior with few other rules also but after going through your ticket guess it makes sense it’s not only C126 which is affected.
@sk2312 I just tested MSBuild 17.6.0-preview-23081-04+7bf511372 and the issue seems to be fixed.
In case you update to the preview version please let me know if it works for you.