Help Figuring Out .NET Project Scan Taking Significantly Longer

Could you send them to @Andrei_Epure as before please? Thanks.

Interesting. Those analyzers don’t correspond to “real” rules, unfortunately, so I don’t think they can be disabled directly. They’re used to generate the metadata required for syntax and reference highlighting when browsing the code on SonarQube/SonarCloud.

I’m surprised they take so long because they don’t do anything complicated. Could you give us a rough idea of the number of lines of code in your solution please?

It appears to be a Test project. We don’t have an exact line count, but we believe it is around 5-10k lines of code. We made some changes to exclude it from the analysis, and this brought the scan down to 7-8 minutes. I think we can say that this is fixed unless you want to try to dig deeper into the cause of the slow down.

1 Like

I am glad you found a solution to the problem. I will try to find out if this behavior (TokenTypeAnalyzer taking lots of time) is consistent over the open source projects we analyze on a daily basis.

Hi @trgabriel,

FYI we’ve created ticket #2929 to track the performance issue as we certainly wouldn’t expect the analyzers that generate the metrics to take nearly eight minutes each to run, especially against a relatively small project.

It’s interesting that the issue only appears for a single project. It may be that there is something about the content of that specific project that is causing a perf issue e.g. a few exceptionally large files (possibly generated), or perhaps hundreds of small files.

If you could share the source of just the test project with us privately that would be ideal (although I realise that’s unlikely unless the application is open-source). Otherwise, if you could give us an rough idea of the number of files in the project and the number of lines of code in the largest file, that would be very helpful.

Thanks,
Duncan

1 Like

@duncanp Sorry for the late reply, I do not believe I am allowed to share the source code, but I can say that it was a test project that was not getting ignored by the scanner. That folder/project is about 48 files. The three largest files are roughly 1750, 950, and 940. Everything else is under 400.

1 Like

No problem. Thanks for the additional information @trgabriel.