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

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

image__1_.png

Is an "OFF" sign displayed in the top right-hand corner of the editor without any highlighting to indicate errors or warnings?

Screenshot_2021-06-18_at_13.30.22.png

If you are experiencing the issues listed above, the file you’re working with is too big for Solution-Wide Analysis to analyze. 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).
If you encounter this issue and only want to analyze a particular file, you need to enable analysis manually. Hover over the "OFF" icon. In the popup that appears, expand the "Highlight" dropdown and select "All Problems".

Screenshot_2021-06-18_at_13.33.47.png

Then Rider will start performing code analysis for this file.

If you have many large files and you want code analysis to work by default for all of them, you’ll need to increase the file size limit. Please be aware, however, that doing so may affect general IDE performance.

To increase the file size limit, you’ll need to redefine the idea.properties and .DotSettings parameters in the IDE properties files. 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/AnalysisFileSizeThreshold/=CSHARP/@EntryIndexedValue">300000</s:Int64>

Make sure the values you provide for the file size limits are greater than the default values of 2,500 and 300,000.

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#
  • CPP (since 2021.3)

Note: for idea.properties, the file size is expressed in  kB while for .DotSettings it is in bytes.

Where to find 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

.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 | Diagnostic Tools -> Special Files and Folders… -> R# Global Settings or Help | Browse Special Paths… -> R# Global Settings in older versions).
  • A team-shared .DotSettings file. The corresponding settings file <SolutionName>.sln.DotSettings is saved in the solution folder.
  • A .DotSettings.user file. The corresponding settings file <SolutionName>.sln.DotSettings.user is saved in the solution folder.

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 this help page.

 

7 comments
Comment actions Permalink

Are there any other known issues where the analysis will stop but it will not be marked as "stopped" ? I have raised an issue here where null checking seems to stop randomly half way through my file.

https://youtrack.jetbrains.com/issue/RSRP-485382

0
Comment actions Permalink

I can suggest an extremely helpful tool to resolve such issues is LongPathTool. Thank you.

0
Comment actions Permalink

Seems like the GlobalSettingsStorage.DotSettings file gets overridden every time. The solution didn't work with Global settings.
It worked with <SolutionName>.sln.DotSettings though.

0
Comment actions Permalink

@Mehrdadkamelzadeh Please make sure that you have added the setting into the `<wpf:ResourceDictionary>` tag` (before `</wpf:ResourceDictionary>` closing tag)  otherwise this setting would be reset because it was added incorrectly.

0
Comment actions Permalink

Lejia Chen Jetbrains - Do we need to update both the .idea file and the .DotSettings file? or can it be one or the other?

Second question:

Is it possible to update this 'gloablly' - instead of 'per solution? 

 

 

Thanks

Edited by Jeff Ward
0
Comment actions Permalink

Are there any profilers to run diagnostics and see when / if the file sizes are to large? Such as a Performance Diagnostic?

0
Comment actions Permalink

Jeff Ward
> Do we need to update both the .idea file and the .DotSettings file?
Yes.
> Is it possible to update this 'gloablly' - instead of 'per solution? 

Please see the end parts of this document:
> .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 | Diagnostic Tools -> Special Files and Folders… -> R# Global Settings or Help | Browse Special Paths… -> R# Global Settings in older versions).
  • A team-shared .DotSettings file. The corresponding settings file <SolutionName>.sln.DotSettings is saved in the solution folder.
  • A .DotSettings.user file. The corresponding settings file <SolutionName>.sln.DotSettings.user is saved in the solution folder.

If you use the way in the first point, it is global instead of the per solution.

> Are there any profilers to run diagnostics and see when / if the file sizes are to large?

There are some ways in `Help | Diagnostic Tools` to profile Rider's performance but it may doesn't helps your case as these profilers won't tell if some of your code file sizes are too large directly and what file sizes are enough for you.

If you open these large files in the Rider and don't feel any sluggish when opening them and working/writing on them compared to the normal code file, then I think it's fine there. Otherwise, the code files might be too large here.

Edited by Lejia Chen
0

Please sign in to leave a comment.

Have more questions?

Submit a request