Searching for custom dictionaries is painfully slow

Apr 13 at 3:53 PM
Jump-up:
Is there some way to stop the documentation rules from trying to find custom dictionaries?

Details:
My company recently moved from 4.6 to 4.7.49.0. StyleCop runs much slower in the new version, occasionally pausing on a single file for 30 or more seconds. A little debugging shows that StyleCop's documentation rules class is attempting to find custom dictionaries in these pauses. The issue appears to have several levels:
  1. We don't have the spelling-based rule (SA1650) enabled, so the dictionaries, I believe, aren't used.
  2. The code that loads dictionaries will add based upon Path.GetDirectoryName(document.SourceCode.Path)) and Path.GetDirectoryName(document.SourceCode.Project.Location)). Both of these paths (especially the latter) could have very large source trees. If the project I'm analyzing is availlable at \MyEntireSource\MyProject, the GetDirectoryName method will return \MyEntireSource. In my typical case, that's hitting a directory whose subdirectories contain several million lines of source code and have probably several thousand directories and tens of thousands of files.
  3. The code that searches for custom dictionaries then looks for several filename permutations all with separate calls to Directory.GetFiles (6 of them), which ends up iterating the source tree once per call.
Added up, a StyleCop analysis that used to take about 30 seconds to a minute in 4.6 now takes 5-10 minutes.

Looking through the source code, I didn't run across any solution outside of changing how StyleCop works, but I've never looked at this code base before, so I'm hoping someone might know more.
May 19 at 4:08 PM
Edited May 19 at 4:09 PM
My team is seeing something similar - turns out there was an issue from 2014 tracking your issue 2, feel free to vote it up!

https://stylecop.codeplex.com/workitem/7643