{"record":{"id":"7a5bef48a24a904c","repo":"dotnet/efcore","slug":"a-synchronous-store-management-operation-was-perfo","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.Cosmos/Storage/Internal/CosmosDatabaseCreator.cs","lineNumber":258,"sourceCode":"    ///     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 SeedDataAsync(\n        bool created,\n        CancellationToken cancellationToken = default)\n    {\n        var coreOptionsExtension =\n            _contextOptions.FindExtension<CoreOptionsExtension>();\n\n        if (coreOptionsExtension?.AsyncSeeder is not null)\n        {\n            await coreOptionsExtension.AsyncSeeder(_currentContext.Context, created, cancellationToken).ConfigureAwait(false);\n        }\n        else if (coreOptionsExtension?.Seeder is not null)\n        {\n            throw new InvalidOperationException(CoreStrings.MissingSeeder);\n        }\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 Task<bool> EnsureDeletedAsync(CancellationToken cancellationToken = default)\n        => _cosmosClient.DeleteDatabaseAsync(cancellationToken);\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>","sourceCodeStart":240,"sourceCodeEnd":276,"githubUrl":"https://github.com/dotnet/efcore/blob/3a2006ef569de08368d59db5e1468aa8f407e4f8/src/EFCore.Cosmos/Storage/Internal/CosmosDatabaseCreator.cs#L240-L276","documentation":"Thrown from SeedDataAsync when an asynchronous seed delegate was not registered but a synchronous one was, yet the async seeding pipeline is being executed. EF Core requires that when you customize seeding you supply both a sync (UseSeeding) and an async (UseAsyncSeeding) delegate, because both the sync and async store pipelines may run. The error tells you to register the matching delegate.","triggerScenarios":"Calling DbContextOptionsBuilder.UseSeeding(...) (sync only) without a matching UseAsyncSeeding(...), then invoking the async store-creation pipeline (EnsureCreatedAsync or the internal async SeedDataAsync on CosmosDatabaseCreator). At CosmosDatabaseCreator.cs:252-258, AsyncSeeder is null and Seeder is non-null, so MissingSeeder is thrown.","commonSituations":"Following an older seeding tutorial that only mentions UseSeeding. Upgrading EF Core to a version that split seeding into sync/async delegates without adding the async overload. ASP.NET Core startup that only configures the sync delegate but the host calls the async path.","solutions":["Add a matching UseAsyncSeeding(async (ctx, created, ct) => { ... }) that mirrors the logic in your UseSeeding callback.","Or, if you only ever run async workflows, switch entirely to UseAsyncSeeding and supply a trivial (or no) sync delegate as required by the framework.","Ensure both delegates perform the same seeding work so behavior is identical regardless of which pipeline runs."],"exampleFix":"// before\noptionsBuilder.UseSeeding((ctx, created) =>\n{\n    ctx.Blogs.Add(new Blog { Url = \"http://blogs.msdn.com\" });\n    ctx.SaveChanges();\n});\n\n// after\noptionsBuilder.UseSeeding((ctx, created) =>\n{\n    ctx.Blogs.Add(new Blog { Url = \"http://blogs.msdn.com\" });\n    ctx.SaveChanges();\n}).UseAsyncSeeding(async (ctx, created, ct) =>\n{\n    ctx.Blogs.Add(new Blog { Url = \"http://blogs.msdn.com\" });\n    await ctx.SaveChangesAsync(ct);\n});","handlingStrategy":"validation","validationCode":"// In a startup test, assert both seeders are configured together\nvar ext = dbContext.Options.FindExtension<CoreOptionsExtension>();\nif (ext?.Seeder is not null && ext?.AsyncSeeder is null\n    || ext?.Seeder is null && ext?.AsyncSeeder is not null)\n{\n    throw new InvalidOperationException(\"Configure UseSeeding AND UseAsyncSeeding together.\");\n}","typeGuard":null,"tryCatchPattern":"try { await dbContext.Database.EnsureCreatedAsync(ct); }\ncatch (InvalidOperationException ex) when (ex.Message.Contains(\"UseSeeding\"))\n{\n    // add the missing UseAsyncSeeding (or UseSeeding) delegate, then retry.\n}","preventionTips":["Always register UseSeeding and UseAsyncSeeding as a matched pair.","Add a startup assertion that both (or neither) seeders are configured.","Keep the bodies of both delegates semantically identical."],"tags":["cosmos","seeding","useasyncseeding","configuration"],"backgroundTag":null,"analyzedSha":"3a2006ef569de08368d59db5e1468aa8f407e4f8","analyzedAt":"2026-08-11T23:42:04.146Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}