SonarAnalyzer.Rules.CSharp.UnusedPrivateMember Analysis Duration

Analysis of one of my projects (1 of 6 with the same setup) is taking almost 30 minutes to analyze

Running msbuild with the following parameters, /p:reportanalyzer=true /v:d

     Total analyzer execution time: 1906.825 seconds.
     NOTE: Elapsed time may be less than analyzer execution time because analyzers can run concurrently.
     Time (s)    %   Analyzer
     1904.096   99   SonarAnalyzer.CSharp, Version=, Culture=neutral, PublicKeyToken=c5b62af9de6d7244
     1871.134   98      SonarAnalyzer.Rules.CSharp.UnusedPrivateMember
        4.575   <1      SonarAnalyzer.Rules.CSharp.LiteralSuffixUpperCase
        1.934   <1      SonarAnalyzer.Rules.SymbolicExecution.SymbolicExecutionRunner
        1.486   <1      SonarAnalyzer.Rules.CSharp.CbdeHandlerRule

I have tried disabling the rule in the quality profile, also tried ignoring the issue on multiple criteria, csharpsquid:S1144

All of the above does not help, how can fix the build duration?

Hi @Robert_Brown , we have some problems with two rules that you may want to disable:

Disable rule S1144 ( Unused private types or members should be removed ) and rule S4487 ( Unread "private" fields should be removed ) (both implemented by UnusedPrivateMember.cs .

We track this in and we want to tackle it this year. Thanks.

1 Like

Update: we’ve fixed the performance problem we were having with the UnusedPrivateMember rule (#2474 ). The fix is included in the 8.13 release.