Skip to content

Latest commit

 

History

History
27 lines (17 loc) · 1.14 KB

PH_S019.md

File metadata and controls

27 lines (17 loc) · 1.14 KB

PH_S019 - Blocking Method in Async Method

Problem

An asynchronous method makes use of a blocking method, although there exists an asynchronous counterpart.

Solution

Replace the blocking method with its asynchronous counterpart.

Additional Note

The methods AddAsync and AddRangeAsync of entity framework's DbSet and DbContext are explicitely excluded from this analysis by default. The documentation recommends using the non-async versions instead.

Options

# A white-space separated list of methods to exclude when searching for async counterparts
# Format: <type-specifier>:<method1>,<method2>
dotnet_diagnostic.PH_S019.exclusions = Microsoft.EntityFrameworkCore.DbContext:Add,AddRange Microsoft.EntityFrameworkCore.DbSet`1:Add,AddRange

# Only report async methods that have a compatible return type: match (default) / ignore
dotnet_diagnostic.PH_S019.returnType = match

# Only report async methods where the first N parameters match: any number (1=default)
dotnet_diagnostic.PH_S019.parameterTypeMatchCount = 1