Description
S6966 should not fire for DbContext.Add as AddAsync is meant for special purposes only:
This method is async only to allow special value generators, such as the one used by 'Microsoft.EntityFrameworkCore.Metadata.SqlServerValueGenerationStrategy.SequenceHiLo', to access the database asynchronously. For all other cases the non async method should be used.
Repro steps
public async Task Test()
{
await using Microsoft.EntityFrameworkCore.DbContext ctx = new(null!);
ctx.Add(null!); // S6966
}
Expected behavior
No S6966 for DbContext.Add
Actual behavior
S6966 is generated for the given example
Known workarounds
Suppress warning (in code, config, ...)
Related information
SonarAnalyzer.CSharp 9.25.0.90414