ReSharper 2024.1 Help

Narrow down DPA scope

There are a number of cases when you might want to exclude certain issues from the DPA issue list.

The main ones are:

This is not an issue

There are cases when DPA marks a particular method as an issue though everything works as intended. For example, a method may allocate a lot of memory not because of bad code design, but just because this is required by the current use case. If these are just a few methods, the best solution is to suppress these issues. If you get a lot of false positives, then probably it is better to increase issue thresholds.

You are not an owner of this code or not interested in analyzing it now

Large solutions include hundreds of projects with many people working on them simultaneously. DPA lets you exclude particular parts of a solution from analysis, so that you can leave only issues related to your current work.

This issue has already been fixed

A rare case when you have already fixed the issue but have not run/debug the solution one more time. If you want such an issue to be hidden from the list, you can mark the issue as fixed.

Short summary:

Shared through VCS

Hides issue until









Process, module, class, method

Mark as fixed


Until next run


Increase thresholds




Suppress issues

To suppress an issue, you must mark the corresponding method with the SuppressMessage attribute. The main benefit of suppressing the issue is that the attribute is set in the source code, so, it can be shared through VCS. The easiest way to set the attribute is to use a context action.

  1. In the editor, find the method you want to suppress. Note that the SuppressMessage attribute makes DPA ignore memory allocations not only in the method itself but in all child calls as well.

  2. Place the caret at the line highlighted by DPA and press Alt+Enter.

  3. In the context action list, choose Suppress {memory allocation | database} issues and then choose what exactly you want to suppress in the current call subtree: only the selected issue, all issues of this type, or all issues.

    DPA. Suppress issue

You can set the SuppressMessage attribute manually. For example:

[SuppressMessage("ReSharper.DPA", checkId: "DPA0002: Excessive memory allocations in SOH", MessageId = "type: Sudoku.Cell")] public Cell Copy() => new Cell(Number, _options);


  • "ReSharper.DPA" is the required attribute category.

  • checkId specifies what issue type must be suppressed (description is optional):

    • "DPA0001: Memory allocation issues": any memory allocation issues.

    • "DPA0002: Excessive memory allocations in SOH": allocations to the small object heap.

    • "DPA0003: Excessive memory allocations in LOH": allocations to the large objects heap.

    • "DPA0004: Closure object allocation": allocations because of closures.

    • "DPA0005: Database issues": any database issues.

    • "DPA0006: Large number of DB commands": large number of database command executions.

    • "DPA0007: Large number of DB records": large number of records in a database response.

    • "DPA0008: Large number of DB connections": large number of simultaneous database connections.

    • "DPA0009: High execution time of DB command": large command execution time.

  • MessageId lets you narrow the attribute's scope by the issue value. You should set the scope filter using a list of key-value pairs: "key1: value1; key2: value2; ..." The following keys are available:

    • type: EXACT_FQN: suppress allocation issues where the objects of the specified type are allocated. EXACT_FQN is the type full name, including namespace and all substitutions of generic types.

    • size: VALUE "B"|"KB"|"MB"|"GB"|"TB": suppress allocation issues if the total size of allocated objects is less than VALUE.

    • count: suppress database issues if the total number of objects (commands, records, or connections) is less than VALUE.

    • time: suppress database command execution time issues if the time in ms is less than VALUE.

    For example: "type: System.Object; type: System.String; size: 500MB"

    This filter means that DPA must suppress all issues related to allocations of objects of the System.Object or System.String types, unless the total size of allocated objects is less than 500MB.

Exclude code from analysis

Excluding may be required when you are not interested in analyzing a particular part of the code, for example, if it is not related to your current work. You can exclude particular processes, modules, classes, and methods: The related issues will be hidden from the Dynamic Program Analysis window and from the editor. Note that you exclude code only for yourself: The excluded issues are not propagated to VCS.

Exclude code from Dynamic Program Analysis

  1. Open Extensions | ReSharper | Windows | Dynamic Program Analysis | Filtering.

  2. In Filters, click Add Add ... next to the required filter rule:

    • Analyze code only in: Specify a process, a module, a class, and/or a method to be included in the dynamic 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 a module and a class to include only methods with the specified name from all modules and all classes.

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

Mark issues as fixed

Marking an issue as fixed is similar to excluding. The main difference is that excluding is permanent while 'marking as fixed' hides the issue until you run/debug your solution: If the issue was not in fact fixed, DPA will return it back to the issue list.

  1. Open the Dynamic Program Analysis window.

  2. Select the issue, and press Delete or choose Ignore | Mark as Fixed in the context menu.

Change issue thresholds

DPA marks a method as an issue only if the inspection value exceeds the threshold. For example, during the run, the method allocated to LOH 55 MB while the threshold is 50 MB. Therefore, the easiest way to eliminate false positives is to increase the corresponding threshold. Note that there is no universal threshold: Depending on the current execution context, your application can allocate different amount of memory. For example, the size of the data your app works with can change from run to run.

You can set a threshold for each issue type in the Thresholds tab of the Dynamic Program Analysis window. The default thresholds are:

  • Closure object: 50 MB

  • Large Object Heap: 50 MB

  • Small Object Heap: 100 MB

  • DB command time: 500 ms

  • DB connections: 10

  • DB commands: 50

  • DB records: 100

  • MVC Action: 500ms

  • Razor Page Handler: 500 ms

  • Razor View Component: 300 ms

  1. Open the Dynamic Program Analysis window.

  2. Do one of the following:

    • Select the issue which is above the current threshold, and in the context menu, choose Ignore | Set New Threshold for .... This will set the corresponding threshold right above the issue allocation value.

    • Switch to the Thresholds tab and set a new threshold value for the desired issue type.

Last modified: 11 February 2024