Compiler warning CA1839 on DbSet.Add
- Dominant language
- C#
- Stars
- 14.8k
- Forks
- 3.4k
- PR merge metrics
- PR metrics pending
Description
Since updating to .NET 8 Preview 7, all calls to `DbSet.Add(TEntity entity)` and `DbSet.AddRange(params TEntity[] entities)` result in a CA1839 compiler warning.
For example, calling `context.Users.Add(user);` results in:
> Warning CA1849 'DbSet.Add(User)' synchronously blocks. Await 'DbSet.AddAsync(User, CancellationToken)' instead.
However, the summary for `AddAsync` reads:
> 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.
Should this warning be suppressed by default?
Contributor guide
Assessment
This issue has not been assessed yet.