JetBrains Rider 2021.1 Help

Detect Code Issues in Design Time

JetBrains Rider starts analyzing a code file as soon as you open it in the editor, all the way you edit it, until it is closed. All detected code issues are highlighted in the editor according to their severity levels. The map of the issues is also displayed on the error stripe in the right part of the editor window, where you can see instantly the status of the file and click the marks to navigate to specific code issues.

Design-time inspection features

Design-time inspection features is a major addition to the basic features of Rider editor. To illustrate the design-time code inspection performed by JetBrains Rider, consider the following code excerpt displayed in the editor:

JetBrains Rider: Design-time code inspection

In this example, we can see the following features of JetBrains Rider code inspection:

  1. If the solution-wide analysis is enabled, all files that contain errors are shown with highlighted tabs.

  2. A medium-priority code issue (in this case, a warning about a symbol name that does not match the naming style) is highlighted with a blue curly underline.

  3. A low-priority code issue (in this case, a suggestion related to an unused public member) is greyed out.

  4. A Status indicator helps you to quickly see whether the current file has any errors or warnings.

  5. Code analysis hints make missing function returns, missing breaks in switch statements, and disposed resources easier to notice.

  6. A fix popup that appears for non-imported types. Simply press Alt+Enter or click this popup to have JetBrains Rider add the missing directive for all types in the file. For more information, see Import Missing Namespaces.

  7. A marker corresponding to a warning is displayed on the error stripe.

  8. A marker corresponding to an error is displayed on the error stripe.

  9. An action indicator that appears to the left of the caret position if JetBrains Rider has anything to suggest there.

  10. High-priority code issues (in this case, errors related to an unresolved symbol and an incorrect return type) are highlighted with red text and a red curly underline.

  11. A marker corresponding to a suggestion is displayed on the error stripe.

  12. The action list, which can be opened by pressing Alt+Enter or clicking the action indicator (7), contains a list of quick-fixes for the issue at the caret.

  13. The 'Pencils' widget helps you to configure highlighting and visual helpers for your code.

  14. If solution-wide analysis is enabled, JetBrains Rider allows you to see even more code issues. In this example, it detects the unused public member and notifies you of errors in other files in your solution. Click the solution-wide analysis icon to explore the detected issues.

  15. A short description of the issue at the caret appears in the status bar. To view descriptions of code issues, hover the mouse over the highlighted code or over the issue markers on the error stripe.

Toggle design-time inspection

By default, design-time code inspection is enabled in all supported languages. However, you can disable it everywhere or turn it off for specific files if needed. For more information on configuring code inspection, see Configure Code Inspection Settings.

  1. Press Ctrl+Alt+S or choose File | Settings (Windows and Linux) or JetBrains Rider | Preferences (macOS) from the menu, then choose Editor | Inspection Settings on the left.

  2. Use the Enable code analysis checkbox to toggle the design-time code inspection.

  3. Optionally, you can enable or disable design-time inspection features on this page:

    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.

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

    Highlight color usagesEnables highlighting of color definitions in code. For more information, see Color Assistance.
    Highlight special characters in string literalsEnables highlighting of correct and incorrect escape sequences in non-verbatim strings. For example:
    Highlighting of escape sequence in strings
    For more information, see Regular Expressions Assistance.
    Highlight context exitsThis option, 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 set the caret to one of these identifiers
    JetBrains Rider highlights context exits
    For a loop, it will additionally highlight the loop keyword as well as all the break statements inside this loop.
    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.
  4. If necessary, you can select the Enable solution-wide analysis checkbox to enable the Solution-Wide Analysis.

  5. Click Save in the Settings dialog to apply the modifications and let JetBrains Rider choose where to save them, or save the modifications to a specific settings layer using the Save To list. For more information, see Layer-Based Settings.

If the design-time code inspection is enabled, you can easily navigate between all issues (except those with the hint severity level) detected in the current file.

Navigate to the next/previous code issue in the current file

  • Press F2 to go to the next code issue, or Shift+F2 to go to the previous code issue.

  • In the main menu, choose Navigate | Next Highlighted Error or. Navigate | Previous Highlighted Error.

  • Use the error stripe on the right side of the editor window: clicking on markers brings the caret to the corresponding issues; clicking on the status indicator on top of the error stripe brings the caret to the next issue in the file.

Navigate to the next/previous error

  • Press Alt+F2 to go to the next error, or Alt+Shift+F2 to go to the previous error.

  • If the Solution-Wide Analysis is enabled and there are some errors, the number of errors is displayed in the right corner of the status bar. You can click this number to go to the next error in the solution.

Inspection options menu

Besides suggested fixes, for each configurable code inspection as well as for custom inspections, JetBrains Rider shows the Inspection [name of inspection] Themed icon settings screen gray sub-menu in the actions list, with the following items:

Inspection [name of inspection] sub-menu

Find similar issues

You can not only fix a highlighted issue with a quick-fix, but also find and investigate all similar issues (all issues detected with the same code inspection) in the whole solution or smaller scope.

Find similar issues

  1. Set the caret at a highlighted issue in the editor.

  2. Press Alt+Enter or click the action indicator to the left of the caret to open the action list.

  3. To find similar issues in the current file, choose Inspection [name of inspection] | Find similar issues in [filename] file.

  4. To find similar issues in the current project or solution, expand the submenu and choose the desired scope:

    Using action list to find similar issues

  5. If necessary, you can search for similar issues in any project or solution folder within your solution. To do so, choose Find similar issues in custom scope in the submenu.
    In the dialog that opens, type the name of the desired project or solution folder, and then click OK.

    Specifying search scope for the similar issues

  6. All found issues will be displayed in the Inspection Results window.

Last modified: 29 June 2021