JetBrains Rider 2021.3 Help

Runtime coverage filters

JetBrains Rider applies runtime filters during a coverage session. Use these filters to exclude unnecessary code from analysis and reduce coverage session time. You can set the runtime filters for a specific namespace, project, type, type member, or attribute.

As filters are applied in runtime, JetBrains Rider does not include the filtered items into the coverage snapshot and does not show them in the Unit Tests Coverage window.

Adding runtime filters

Add a runtime coverage filter

  1. Open the filter settings page in Rider settings: Build, Execution, Deployment| dotCover | Filtering.

  2. In Runtime coverage filters, click Add filter Add ... next to the required filter rule:

    • Analyze code only in: Specify an assembly, a class, and/or a method to be included in the coverage analysis. All other code items will be excluded. Code items are filtered independently on one another. For example, you can specify a method and leave asterisks * for assembly and class to include only methods with the specified name from all assemblies and all classes.

    • Do not analyze code in: Specify an assembly, a class, and/or a method to be excluded from the coverage analysis. Code items are filtered independently on one another.

    • Do not analyze code marked with attributes: Specify the fully qualified attribute class name that will be used to exclude symbols from the coverage analysis. For example, System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverageAttribute or *.ExcludeFromCodeCoverageAttribute.

    You can use asterisk wildcards when specifying code item names in a filter: * (asterisk) represents zero or more characters.

    For example, you can use the *.Tests wildcard in Do not analyze code in to exclude all test projects from code analysis.

  3. Click Save to save the filter settings and apply your modifications.

Last modified: 22 December 2021