Rider Cannot Analyze a Source File Because It’s Too Large

Does your project have large auto-generated .cs/.fs/.vb files where some capabilities are unavailable, such as code highlighting, code completion, or other SWA-dependent features? Do you see the message “Document size has exceeded the threshold. Right-click to see the options.” in the Solution-Wide Analysis tooltip? 

image__1_.png

If you are experiencing the symptoms listed above, it means Solution Wide Analysis was unable to analyze the opened file because of its size. Indeed, Rider has a default limit for the maximum size of files it will parse, and the limit is not very high (300 KB by default).

To have those code analysis features available,  you need to increase the file size limit by redefining the corresponding parameters in the IDE properties files, idea.properties and .DotSettings. To do this, add the following properties to the corresponding settings files:

idea.properties 

idea.max.intellisense.filesize=2500

.DotSettings 

<s:Int64 x:Key="/Default/PerformanceThreshold/BuildPsiFileSizeThreshold/=CSHARP/@EntryIndexedValue">300000</s:Int64>
<s:Int64 x:Key="/Default/PerformanceThreshold/AnalysisFileSizeThreshold/=CSHARP/@EntryIndexedValue">300000</s:Int64>

Make sure to set a greater number for the file size instead of the default 2500 and 300000 .

You can set the file size not only for .cs files, but also for .vb and .fs files. Here are the possible language keys for the settings above: 

  • CSHARP
  • VBASIC
  • F#

Note: for idea.properties, the filesize is expressed in KB while for .DotSettings it is in bytes.

Where to find the settings files

idea.properties

Go to Help | Edit Custom Properties.

Please note that changes in idea.properties will take effect only after restarting Rider.

.DotSettings file

.DotSettings files store backend settings which are layer-based. There are three possible files where you can set the file size threshold; select the one that suits your needs best:

  • GlobalSettingsStorage.DotSettings (go to Help | Browse Special Paths… -> R# Global Settings).
  • A team-shared .DotSettings file, which is located in a folder containing your sln file (if any).
  • A .DotSettings.user file, which is locatedis located in a folder containing your sln file (if any).

We recommend using the team-shared layer because if the issue is relevant for you, it probably is also relevant for all your teammates working on the same solution.

For more about Rider settings, see the corresponding help page.

 

Please sign in to leave a comment.

Have more questions?

Submit a request