{"record":{"id":"656cf17e45dc9160","repo":"microsoft/aspire","slug":"nameof-oracleentityframeworkcoresettings-nameof","errorCode":null,"errorMessage":"{nameof(OracleEntityFrameworkCoreSettings)}.{nameof(OracleEntityFrameworkCoreSettings.DisableRetry)} needs to be set when a custom Execution Strategy is configured.","messagePattern":"(.+?)\\.(.+?) needs to be set when a custom Execution Strategy is configured\\.","errorType":"exception","errorClass":"InvalidOperationException","httpStatus":null,"severity":"error","filePath":"src/Components/Aspire.Oracle.EntityFrameworkCore/AspireOracleEFCoreExtensions.cs","lineNumber":148,"sourceCode":"                        var extension = optionsBuilder.Options.FindExtension<OracleOptionsExtension>();\n\n                        if (!settings.DisableRetry)\n                        {\n                            var executionStrategy = extension?.ExecutionStrategyFactory?.Invoke(new ExecutionStrategyDependencies(null!, optionsBuilder.Options, null!));\n\n                            if (executionStrategy != null)\n                            {\n                                if (executionStrategy is OracleRetryingExecutionStrategy)\n                                {\n                                    // Keep custom Retry strategy.\n                                    // Any sub-class of OracleRetryingExecutionStrategy is a valid retry strategy\n                                    // which shouldn't be replaced even with DisableRetry == false\n                                }\n                                else if (executionStrategy.GetType() != typeof(OracleExecutionStrategy))\n                                {\n                                    // Check OracleExecutionStrategy specifically (no 'is'), any sub-class is treated as a custom strategy.\n\n                                    throw new InvalidOperationException($\"{nameof(OracleEntityFrameworkCoreSettings)}.{nameof(OracleEntityFrameworkCoreSettings.DisableRetry)} needs to be set when a custom Execution Strategy is configured.\");\n                                }\n                                else\n                                {\n                                    options.ExecutionStrategy(context => new OracleRetryingExecutionStrategy(context));\n                                }\n                            }\n                            else\n                            {\n                                options.ExecutionStrategy(context => new OracleRetryingExecutionStrategy(context));\n                            }\n                        }\n\n                        if (settings.CommandTimeout.HasValue)\n                        {\n                            if (extension != null &&\n                                extension.CommandTimeout.HasValue &&\n                                extension.CommandTimeout != settings.CommandTimeout)\n                            {","sourceCodeStart":130,"sourceCodeEnd":166,"githubUrl":"https://github.com/microsoft/aspire/blob/25830f84bd145686607ad00c057b3f84e2e51d43/src/Components/Aspire.Oracle.EntityFrameworkCore/AspireOracleEFCoreExtensions.cs#L130-L166","documentation":"EnrichOracleDatabaseDbContext detects an ExecutionStrategy whose exact type is not OracleExecutionStrategy (any subclass is custom) and throws because automatic retry cannot be combined with a custom strategy — DisableRetry must be explicitly set to acknowledge this.","triggerScenarios":"Calling EnrichOracleDatabaseDbContext on a DbContext whose options carry a custom execution strategy (e.g. a custom OracleRetryingExecutionStrategy subclass or manually configured strategy) while OracleEntityFrameworkCoreSettings.DisableRetry is false/not set.","commonSituations":"Existing DbContexts that configured their own retry logic migrated to Aspire enrichment; subclassing OracleExecutionStrategy for custom retry policies; mixing UseOracle options with enrichment settings.","solutions":["Set DisableRetry = true via the settings callback: builder.EnrichOracleDatabaseDbContext<TContext>(s => s.DisableRetry = true)","Remove the custom execution strategy and let Aspire configure OracleRetryingExecutionStrategy for you","Keep the custom strategy only together with DisableRetry = true"],"exampleFix":"// before\nbuilder.EnrichOracleDatabaseDbContext<MyDbContext>(); // custom execution strategy present\n// after\nbuilder.EnrichOracleDatabaseDbContext<MyDbContext>(settings => settings.DisableRetry = true);","handlingStrategy":"validation","validationCode":"bool hasCustomStrategy = oracleDbContextOptions.ExecutionStrategy is not null &&\n    oracleDbContextOptions.ExecutionStrategy.GetType() != typeof(OracleExecutionStrategy);\nif (hasCustomStrategy)\n    aspireSettings.DisableRetry = true; // set before EnrichOracleDatabaseDbContext","typeGuard":null,"tryCatchPattern":"try\n{\n    builder.EnrichOracleDatabaseDbContext<MyDbContext>();\n}\ncatch (InvalidOperationException ex) when (ex.Message.Contains(\"DisableRetry\"))\n{\n    logger.LogError(ex, \"Custom execution strategy conflicts with Aspire retry settings.\");\n    throw;\n}","preventionTips":["Decide whether Aspire or the DbContext owns retry policy","Always pair custom execution strategies with DisableRetry = true","Avoid subclassing OracleExecutionStrategy when using Aspire enrichment"],"tags":["oracle","ef-core","execution-strategy","retry","configuration"],"backgroundTag":"conflicting-config-options","analyzedSha":"25830f84bd145686607ad00c057b3f84e2e51d43","analyzedAt":"2026-09-16T11:10:06.193Z","contentChangedAt":"2026-09-16T11:10:06.193Z","schemaVersion":2},"datasetVersion":"2026-09-21T09:17:21.228Z"}