diff --git a/src/Uno.Extensions.Configuration/ConfigBuilderExtensions.cs b/src/Uno.Extensions.Configuration/ConfigBuilderExtensions.cs index ea7ef9a11f..492254fa5a 100644 --- a/src/Uno.Extensions.Configuration/ConfigBuilderExtensions.cs +++ b/src/Uno.Extensions.Configuration/ConfigBuilderExtensions.cs @@ -120,14 +120,11 @@ public static IConfigBuilder Section( { if (configSection is null) { - if (configurationSection is { Length: > 0 }) + if (configurationSection is not { Length: > 0 }) { - configSection = ctx => ctx.Configuration.GetSection(configurationSection); - } - else - { - configSection = ctx => ctx.Configuration.GetSection(typeof(TSettingsOptions).Name); + configurationSection = typeof(TSettingsOptions).Name; } + configSection = ctx => ctx.Configuration.GetSection(configurationSection); } static string? FilePath(HostBuilderContext hctx) @@ -160,7 +157,7 @@ public static IConfigBuilder Section( } var section = configSection(ctx); - services.ConfigureAsWritable(section, configPath); + services.ConfigureAsWritable(section, configPath, configurationSection); } ).AsConfigBuilder();