JetBrains Rider 2023.3 Help

Inspection Settings

In this page of JetBrains Rider settings, you can specify your preferences for code inspection.

Enable code analysis

Select this checkbox to enable design-time code inspection.

Regardless of this checkbox, you can always run code inspection in specific scope.

Analysis

Read settings from editorconfig, project settings and rule sets

If you use EditorConfig to maintain code styles for your project, you can also configure code inspections from .editorconfig files.

If this checkbox is enabled, you can configure code inspection severity levels and C# naming styles right from .editorconfig files.

This checkbox also enables reading code inspection severity settings from Roslyn Analysers Rule Sets. For more information, refer to Rule Sets format

Enable solution-wide analysis

Enables solution-wide analysis (including solution-wide code inspections), which is disabled by default.

Note that in large solutions, solution-wide analysis may result in some performance degradation. However, there are several ways to improve the performance of solution-wide analysis.

Enable computationally expensive inspections

Turns on the data-flow analysis and brings additional inspections, for example, to calculate nullability.

Monitor warnings

Enables warnings in solution-wide analysis.

When warnings are enabled in solution-wide analysis, it works as follows: as long as there are errors in the solution, only errors will be displayed; unresolved warnings will only appear when the last error is fixed. When warnings are disabled, the status bar indicator will turn green as soon as the last error is fixed.

When this option is enabled, you can click ThemedIcon.Warning.Screen.(Gray).png on the toolbar of the All Solution Files tab of the Problems tool window Alt+6 to show or hide warnings in the window and in the status bar indicator without restarting the analysis.

Include source generated files

Use this checkbox to choose whether to monitor source generated files.

Resources utilization

Use this selector to define how solution-wide analysis should use system resources. Low means low resource usage, but longer analysis time. High means less time spent on initial analysis on multiple-core machines.

Show unused non-private type members when solution-wide analysis is off

When this option is enabled, JetBrains Rider will detect all unused non-private members even if solution-wide analysis is disabled. This option does not have any significant performance impact on small- and medium-sized solutions.

However, you may want to disable it if you experience performance problems in a large solution or when working with very large source files.

Show unused global using directives when solution-wide analysis is off

When this option is enabled, JetBrains Rider will report all global using directives that reference unused namespaces even if solution-wide analysis is disabled. This option does not have any significant performance impact on small- and medium-sized solutions.

However, you may want to disable it if you experience performance problems in a large solution.

Value analysis mode

Using the value analysis, JetBrains Rider finds out which entities can hold null value and highlights possible errors with null dereference. You can choose one of the following modes.

  • Optimistic: when explicitly marked with [CanBeNull] attribute, or checked for null — JetBrains Rider assumes that only entities explicitly marked with CanBeNull or ItemCanBeNull attribute or explicitly checked for being null, can be null.

  • Pessimistic: when entity doesn't have explicit [NotNull] attribute — JetBrains Rider assumes that all nullable entities without an explicit NotNull or ItemNotNull attributes can be null.

Nullable reference types' warnings mode

If nullable reference types (NRT) are enabled, JetBrains Rider reuses the results of C# compiler analysis.

NRT improve overall precision of the nullability analysis, but there are cases when NRT contracts can be violated, for example, when values are coming from code without #nullable context. In such cases you may get false positive warnings for nullability checks (for example, Expression is always 'true' or 'false') . In such cases, you can choose to ignore nullable API contracts and report a problem only when previous operations with the value in your code guarantee that it can or cannot be null.

For more information, refer to Nullable reference types.

Dispose analysis mode

Choose one of the modes of the dispose analysis.

When you receive an object via a [MustDisposeResource] API, JetBrains Rider will always consider it disposed and issue no warnings if you wrap the corresponding variable in a using or if you explicitly call Dispose() on that variable.

If instead you pass the disposable variable as an argument to a method, JetBrains Rider will issue warnings depending on the analysis mode:

  • Optimistic (default): All methods that accept IDisposable or a derived type are considered safe; that is we assume that they will call Dispose() after processing the object.

  • Pessimistic: A method is only considered safe if the parameter that accepts IDisposable is marked with the [HandlesResourceDisposal] attribute. Otherwise, JetBrains Rider will report a non-disposed variable.

Analyze integer arithmetic

Use this checkbox to enable or disable the analysis of integer values (integral arithmetics).

Optimize incremental analysis

When turned on, full file rehighlighting tracks which members were inspected and does not reanalyze them if modifications only change other members within a file

Highlighting

Color identifiers

This option lets you enable or disable syntax highlighting scheme.

If it is selected, language identifiers are highlighted with colors as defined in settings pages under the Editor | Color Scheme page of JetBrains Rider settings Ctrl+Alt+S. in Visual Studio options: Tools | Options | Environment | Fonts and Colors.

Note that by disabling this option you also disable symbol information tooltips that appear on mouse over.

Highlight color usages

Enables highlighting of color definitions in code. For more information, refer to Color assistance.

Highlight special characters in string literals

Enables highlighting of correct and incorrect escape sequences in non-verbatim strings. For example: Highlighting of escape sequence in strings For more information, refer to Regular expressions assistance.

Highlight captured primary parameters

When this option is enabled, JetBrains Rider changes syntax highlighting of primary constructor parameters that are used in instance members. Such parameters become captured in the instance context and behave like instance fields, therefore it is convenient to have them syntactically highlighted as fields.

In the example below, the firstName parameter is used to initialize the First property, but it is not captured because the compiler will create a backing field for First and copy the constructor argument there.

lastName on the other hand will be preserved as field to return its value when the Last property is accessed. Therefore, JetBrains Rider highlights firstName as a normal parameter, but lastName as a field:

JetBrains Rider: Syntax highlighting of a captured parameter in a primary constructor

Caret-dependent highlighting

Highlight usages of the element under the cursor

By default, when you set a caret at a declaration or a usage of a variable or a member, all other usages of that symbol in the file are displayed with a background highlighting. Use this checkbox to toggle this behavior.

Highlight context exits

This option, which is enabled by default, tells JetBrains Rider to highlight all places where the control flow can exit the current context. For example, for a method, it will highlight the return type of the method, all return, throw keywords, and so on when you place the caret to one of these identifiers.

JetBrains Rider highlights context exits

For a loop or a switch statement, it will additionally highlight the loop keywords as well as all the break statements inside it.

Note that if a method is not entirely visible in the editor, you can invoke the Navigate To: Function Exits command on the method name to trigger another kind of highlighting, which will not disappear when your caret leaves the method name.

Highlight related async/await keywords

This option enables highlighting of all async and await keywords in a function when your caret is on one of them.

Highlight condition elements

This option enables highlighting of matching logical and conditional operators (|, ||, &, &&, as well as ? and ? pairs) that work together in a complex expressions when your caret is at one of such operators.

In the example below, %product helps understand that the highlighted operators will be evaluated together, while the value1 > 1 || value2 >= 2 && condition1 part will be evaluated before, and the || value6 %lt; value7 || condition2 part will be evaluated after, according to the operator precedence.

JetBrains Rider: Highlighting of matching logical operators

Quick fixes and context actions

Use parallel code analysis when applying fixes/actions in scope

Use solution-wide analysis results when applying quick fixes in scope

Elements to skip

JetBrains Rider allows you to configure the list of files, file masks, and folders that should be excluded from code inspection. The excluded items are ignored by both design-time code inspection and code inspection in specific scope, but they are still indexed by JetBrains Rider, so that you can navigate to or refactor symbols excluded from code inspection.

Last modified: 21 March 2024