{"record":{"id":"78bcca33309f6891","repo":"microsoft/aspire","slug":"conflicting-values-for-commandtimeout-were-found-in-nameof-78bcca","errorCode":null,"errorMessage":"Conflicting values for 'CommandTimeout' were found in {nameof(OracleEntityFrameworkCoreSettings)} and set in DbContextOptions<{typeof(TContext).Name}>.","messagePattern":"Conflicting values for 'CommandTimeout' were found in (.+?) and set in DbContextOptions<(.+?)>\\.","errorType":"exception","errorClass":"InvalidOperationException","httpStatus":null,"severity":"error","filePath":"src/Components/Aspire.Oracle.EntityFrameworkCore/AspireOracleEFCoreExtensions.cs","lineNumber":167,"sourceCode":"                                }\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                            {\n                                throw new InvalidOperationException($\"Conflicting values for 'CommandTimeout' were found in {nameof(OracleEntityFrameworkCoreSettings)} and set in DbContextOptions<{typeof(TContext).Name}>.\");\n                            }\n\n                            options.CommandTimeout(settings.CommandTimeout);\n                        }\n                    });\n                }\n            }\n#pragma warning restore EF1001 // Internal EF Core API usage.\n        }\n    }\n\n    private static void ConfigureInstrumentation<[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicConstructors | DynamicallyAccessedMemberTypes.NonPublicConstructors | DynamicallyAccessedMemberTypes.PublicProperties)] TContext>(IHostApplicationBuilder builder, OracleEntityFrameworkCoreSettings settings) where TContext : DbContext\n    {\n        if (!settings.DisableTracing)\n        {\n            builder.Services.AddOpenTelemetry().WithTracing(tracerProviderBuilder =>\n            {\n                tracerProviderBuilder.AddOracleDataProviderInstrumentation(settings.InstrumentationOptions);","sourceCodeStart":149,"sourceCodeEnd":185,"githubUrl":"https://github.com/microsoft/aspire/blob/25830f84bd145686607ad00c057b3f84e2e51d43/src/Components/Aspire.Oracle.EntityFrameworkCore/AspireOracleEFCoreExtensions.cs#L149-L185","documentation":"Guard in EnrichOracleDatabaseDbContext: the application set CommandTimeout in OracleEntityFrameworkCoreSettings while the DbContext's own options (DbContextOptionsBuilder in OnConfiguring/AddDbContext) also specify a CommandTimeout. Aspire refuses to pick a winner because the two sources conflict and silently overriding one would surprise the other configuration path.","triggerScenarios":"Calling EnrichOracleDatabaseDbContext with settings.CommandTimeout set while the DbContext's OracleOptionsExtension has a different CommandTimeout (e.g. configured in UseOracle options delegate or OnConfiguring).","commonSituations":"Timeout set in DbContext configuration and later also in Aspire settings; values diverged after changing one place only; environment-specific overrides introducing a mismatch.","solutions":["Set CommandTimeout in only one location (settings or DbContext options)","Align both values so they are equal","Omit CommandTimeout from the settings to let the DbContext option stand"],"exampleFix":"// before\nbuilder.EnrichOracleDatabaseDbContext<MyDbContext>(s => s.CommandTimeout = 120);\n// DbContext: UseOracle(..., o => o.CommandTimeout(30))\n// after\nbuilder.EnrichOracleDatabaseDbContext<MyDbContext>(s => s.CommandTimeout = 30); // match, or remove one\n","handlingStrategy":"validation","validationCode":"var settingsTimeout = aspireSettings.CommandTimeout;\nvar optionsTimeout = dbContextOptions.Extensions.OfType<OracleOptionsExtension>().FirstOrDefault()?.CommandTimeout;\nif (settingsTimeout.HasValue && optionsTimeout.HasValue && settingsTimeout != optionsTimeout)\n    throw new InvalidOperationException(\"CommandTimeout differs between Aspire settings and DbContext options.\");","typeGuard":null,"tryCatchPattern":"try\n{\n    builder.EnrichOracleDatabaseDbContext<MyDbContext>();\n}\ncatch (InvalidOperationException ex) when (ex.Message.Contains(\"Conflicting values for 'CommandTimeout'\"))\n{\n    logger.LogError(ex, \"CommandTimeout is set in two places with different values.\");\n    throw;\n}","preventionTips":["Use one source of truth for CommandTimeout","Audit UseOracle/OnConfiguring for CommandTimeout before enriching","Keep environment-specific timeout overrides in a single config key"],"tags":["oracle","ef-core","command-timeout","configuration-conflict"],"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"}