{"record":{"id":"331ad75c3c6c6718","repo":"dotnet/efcore","slug":"a-synchronous-store-management-operation-was-perfo-331ad7","errorCode":null,"errorMessage":"A synchronous store management operation was performed and no synchronous seed delegate has been provided, however an asynchronous seed delegate was. Set 'UseSeeding' option with a delegate equivalent to the one supplied in 'UseAsyncSeeding'.","messagePattern":"A synchronous store management operation was performed and no synchronous seed delegate has been provided, however an asynchronous seed delegate was\\. Set 'UseSeeding' option with a delegate equivalent to the one supplied in 'UseAsyncSeeding'\\.","errorType":"exception","errorClass":"InvalidOperationException","httpStatus":null,"severity":"error","filePath":"src/EFCore.InMemory/Storage/Internal/InMemoryDatabaseCreator.cs","lineNumber":82,"sourceCode":"    ///     any release. You should only use it directly in your code with extreme caution and knowing that\n    ///     doing so can result in application failures when updating to a new Entity Framework Core release.\n    /// </summary>\n    public virtual bool EnsureCreated()\n    {\n        var created = Database.EnsureDatabaseCreated();\n\n        var coreOptionsExtension =\n            _contextOptions.FindExtension<CoreOptionsExtension>()\n            ?? new CoreOptionsExtension();\n\n        var seed = coreOptionsExtension.Seeder;\n        if (seed != null)\n        {\n            seed(_currentContext.Context, created);\n        }\n        else if (coreOptionsExtension.AsyncSeeder != null)\n        {\n            throw new InvalidOperationException(CoreStrings.MissingSeeder);\n        }\n\n        return created;\n    }\n\n    /// <summary>\n    ///     This is an internal API that supports the Entity Framework Core infrastructure and not subject to\n    ///     the same compatibility standards as public APIs. It may be changed or removed without notice in\n    ///     any release. You should only use it directly in your code with extreme caution and knowing that\n    ///     doing so can result in application failures when updating to a new Entity Framework Core release.\n    /// </summary>\n    public virtual async Task<bool> EnsureCreatedAsync(CancellationToken cancellationToken = default)\n    {\n        var created = Database.EnsureDatabaseCreated();\n\n        var coreOptionsExtension =\n            _contextOptions.FindExtension<CoreOptionsExtension>()\n            ?? new CoreOptionsExtension();","sourceCodeStart":64,"sourceCodeEnd":100,"githubUrl":"https://github.com/dotnet/efcore/blob/dbf9771522148d61a2467854921bd5dc6f6e6916/src/EFCore.InMemory/Storage/Internal/InMemoryDatabaseCreator.cs#L64-L100","documentation":"EnsureCreated() (synchronous) throws when only an asynchronous seed delegate (AsyncSeeder via UseAsyncSeeding) was configured and no synchronous Seeder (UseSeeding) exists (InMemoryDatabaseCreator.cs:80-83). EF refuses to silently skip seeding on a sync code path when the user clearly intended async seeding.","triggerScenarios":"Configuring options with UseAsyncSeeding(...) but not UseSeeding(...), then calling context.Database.EnsureCreated() (the sync method).","commonSituations":"Setting up database seeding only for the async path and then calling EnsureCreated synchronously in a startup path or test setup.","solutions":["Add UseSeeding(...) with a delegate equivalent to the UseAsyncSeeding delegate so both paths are covered.","Switch the caller to EnsureCreatedAsync() instead of EnsureCreated()."],"exampleFix":"// before\noptions.UseAsyncSeeding((ctx, _, ct) => SeedAsync(ctx, ct));\n// after\noptions\n    .UseSeeding((ctx, _) => Seed(ctx))\n    .UseAsyncSeeding((ctx, _, ct) => SeedAsync(ctx, ct));","handlingStrategy":"validation","validationCode":"// Ensure both seeders are configured together before calling sync creation:\noptionsBuilder\n    .UseSeeding((ctx, _) => Seed(ctx))\n    .UseAsyncSeeding((ctx, _, ct) => SeedAsync(ctx, ct));","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Always configure UseSeeding and UseAsyncSeeding together so both sync and async paths work.","If you only configure one, only call the matching EnsureCreated/EnsureCreatedAsync.","Keep the two seed delegates logically equivalent to avoid divergence."],"tags":["ef-core","in-memory-provider","seeding","ensure-created","configuration"],"analyzedSha":"dbf9771522148d61a2467854921bd5dc6f6e6916","analyzedAt":"2026-08-06T20:46:03.226Z","schemaVersion":2},"datasetVersion":"2026-08-07T03:17:09.362Z"}