New Roslyn analyzer rule does not run in SQ 6.7.1

Hi,

I’m using SQ 6.7.1. I created a Roslyn analyzer and tested it locally, everything works fine.

I then used the SDK to export it to SQ, I then dropped the new .jar in the extensions\plugins directory. Restarted SQ and I can now see my rule.

When I activate the rule for my Quality Profile and run my build SQ does execute all the rules except my new rule. I activated the logs and I can see that SQ is loading my analyzer, so it should run the rule.

2019-05-03T16:47:02.3258853Z 12:47:02.231 DEBUG: Plugins:
2019-05-03T16:47:02.3259409Z 12:47:02.231 DEBUG: * SonarC# 7.13.0.8313 (csharp)
2019-05-03T16:47:02.3261833Z 12:47:02.231 DEBUG: * SonarHTML 3.0.1.1444 (web)
2019-05-03T16:47:02.3262133Z 12:47:02.231 DEBUG: * Git 1.8.0.1574 (scmgit)
2019-05-03T16:47:02.3262350Z 12:47:02.231 DEBUG: * SonarTS 1.9.0.3766 (typescript)
2019-05-03T16:47:02.3262528Z 12:47:02.231 DEBUG: * SonarVB 7.13.0.8313 (vbnet)
2019-05-03T16:47:02.3262757Z 12:47:02.231 DEBUG: * SystemTeam-CSharp-Analyzer 1.0.0 (systemteamcsharpanalyzer)
2019-05-03T16:47:02.3262946Z 12:47:02.231 DEBUG: * SonarJS 5.1.1.7506 (javascript)

Is there anything that I can do to make this works?

Thank you in advance.

Robert

I did some more testing, thinking that maybe the problem was my analyzer. So I created a brand new analyzer with VS 2017, compiled it and put it in SQ.

Same result sadly. If anyone has an idea I’d appreciate it

Hi @rlejeune. Could you give us the logs from the 3 different steps of the analysis? If you don’t want to make them public, you can send me a private message on this forum.

1 Like

Hi!

I finally found it with some help. Problem was that I was using a version of Roslyn too recent versus the project I was analyzing.

If I was to suggest something, an error message somewhere on the build, or in SQ would be cool :slight_smile: Once I got back to an older version of roslyn everything started working just fine.

thanks for the follow-up, @rlejeune. What Roslyn version were you using when things didn’t work?

I was using 2.9.0, downgraded to 1.3.2

Thanks, @rlejeune. We are mentioning the limitation in the Roslyn SDK README: the analyzer must use Roslyn 2.8.2 or lower

However, we can for sure improve things. I’ve opened #119 to output a warning.

FYI the same issue was raised in the SonarQube Roslyn SDK at about the same time as creating this post so there’s been some duplication of effort investigating the problem. We worked out what the problem was in the GitHub issue.

In summary, the issues weren’t appearing because an “old” version of MSBuild was being used i.e. the analyzer referenced a newer version of Roslyn than the one being used by the instance of MSBuild -> MSBuild couldn’t create an instance of the analyzer -> no issues raised.

(As a general request to forum users, please don’t raise the same issue in multiple places, or at least if you do, cross-link them to make it clear they’re related. Thank you! :slight_smile: )