Analysis stopped: too many visited blocks (threshold: 100)

During a build of .net code using MSBuild Tools 2015 Update 3, I find that one of our projects just hangs on the csc.exe compiler step indefinitely when run with sonarscanner 5.1.0

I have disabled the project from analysis by adding the exclusion to .csproj, that worked in that the build didn’t get stuck, but I would still like to analyse the project, so I re-enabled it again, and then just disabled all the C-Sharp rules and the project still built successfully so this I believe pin points to an issue with one of the c-sharp rules.

So I updated msbuild command line to include : /p:reportanalyzer=true /v:d

This then shows me on every other project how long each rule is taking to execute and the rule, which is great, however for the project which hangs.

I’m getting lots of lines say it’s analyzing file in the format of

Analyzing file “E:\src\PROC-NCI1-JOB1.sonarqube\out\17\cbde\assemblies\Plugins.\17917713\blah.mlir”

Analyzing file “E:\src\PROC-NCI1-JOB1.sonarqube\out\17\cbde\assemblies\Plugins.\17917713\blah2.mlir”

Then it hits a file:

Analyzing file E:\src\PROC-NCI1-JOB1.sonarqube\out\17\cbde\assemblies\Plugins.\17917713\Myfile_1.mlir

which is then followed by the message: Analysis stopped: too many visited blocks (threshold: 100)
which is repeated hundreds and thousands of times in the logs.

The build then needs to be terminated manually or else it will keep running indefinitely outputting this message.

So this is indicating there is some kind of looping going on when scanning the file but there is no output to say what rule is causing the problem.

Any ideas on how to trouble shoot this further or what the problem could be?

I have tried adding the file to the code coverage exclusions and this will skip over the analyser but then I just have the same problem occurring on another file within that project. I’ve looked at the source files and I cannot see anything which could be causing the problem, one of the files is just an enum with a 10 entries in it with just a couple decorators on it.

Hi @MrDom, it seems that there is a bug on RSPEC-3949. You could quickly double check this by disabling the rule and re-running the analysis.

Would it be possible to send us the generated mlir file which causes the issue?

Thank you,