Skip to content

False Positive with VSTHRD103 and EF Core IDbContextFactory<TContext>.CreateDbContext() #1679

Description

@wertzui

Bug description

IDbContextFactory<TContext>.CreateDbContext() incorrectly reports VSTHRD103 and suggest to use CreateDbContextAsync() although the async method should only be used in edge cases.

Repro steps

var factory = new Microsoft.EntityFrameworkCore.DbContextFactory<Microsoft.EntityFrameworkCore.DbContext>();
factory.CreateDbContext();

Expected behavior

No warning

Actual behavior

warning VSTHRD103: CreateDbContext synchronously blocks. Await CreateDbContextAsync instead.

  • Version used: 17.14.15

Additional context

.Net 10
Simmilar to #1480

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions