Skip to content

Commit d687378

Browse files
Merge commit 'f9ae0f5d30be2de3c0de61b5673bd8873231d70a' into internal-merge-6.0-2022-04-12-1158
2 parents e71384f + f9ae0f5 commit d687378

File tree

7 files changed

+113
-61
lines changed

7 files changed

+113
-61
lines changed

NuGet.config

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,10 @@
44
<clear />
55
<!--Begin: Package sources managed by Dependency Flow automation. Do not edit the sources below.-->
66
<!-- Begin: Package sources from dotnet-runtime -->
7+
<add key="darc-int-dotnet-runtime-be98e88" value="https://pkgs.dev.azure.com/dnceng/internal/_packaging/darc-int-dotnet-runtime-be98e88c/nuget/v3/index.json" />
78
<!-- End: Package sources from dotnet-runtime -->
89
<!-- Begin: Package sources from dotnet-efcore -->
10+
<add key="darc-int-dotnet-efcore-aca50ae" value="https://pkgs.dev.azure.com/dnceng/internal/_packaging/darc-int-dotnet-efcore-aca50aef/nuget/v3/index.json" />
911
<!-- End: Package sources from dotnet-efcore -->
1012
<!--End: Package sources managed by Dependency Flow automation. Do not edit the sources above.-->
1113
<add key="dotnet-eng" value="https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-eng/nuget/v3/index.json" />
@@ -25,8 +27,10 @@
2527
<clear />
2628
<!--Begin: Package sources managed by Dependency Flow automation. Do not edit the sources below.-->
2729
<!-- Begin: Package sources from dotnet-efcore -->
30+
<add key="darc-int-dotnet-efcore-aca50ae" value="true" />
2831
<!-- End: Package sources from dotnet-efcore -->
2932
<!-- Begin: Package sources from dotnet-runtime -->
33+
<add key="darc-int-dotnet-runtime-be98e88" value="true" />
3034
<!-- End: Package sources from dotnet-runtime -->
3135
<!--End: Package sources managed by Dependency Flow automation. Do not edit the sources above.-->
3236
</disabledPackageSources>

eng/Version.Details.xml

Lines changed: 37 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -9,37 +9,37 @@
99
-->
1010
<Dependencies>
1111
<ProductDependencies>
12-
<Dependency Name="dotnet-ef" Version="6.0.3">
12+
<Dependency Name="dotnet-ef" Version="6.0.4">
1313
<Uri>https://dev.azure.com/dnceng/internal/_git/dotnet-efcore</Uri>
14-
<Sha>0257e5c118d78ce1b4d5e514779240c929c4b8aa</Sha>
14+
<Sha>aca50aef8604cc23910d18edce820e0fa7c61910</Sha>
1515
</Dependency>
16-
<Dependency Name="Microsoft.EntityFrameworkCore.InMemory" Version="6.0.3">
16+
<Dependency Name="Microsoft.EntityFrameworkCore.InMemory" Version="6.0.4">
1717
<Uri>https://dev.azure.com/dnceng/internal/_git/dotnet-efcore</Uri>
18-
<Sha>0257e5c118d78ce1b4d5e514779240c929c4b8aa</Sha>
18+
<Sha>aca50aef8604cc23910d18edce820e0fa7c61910</Sha>
1919
</Dependency>
20-
<Dependency Name="Microsoft.EntityFrameworkCore.Relational" Version="6.0.3">
20+
<Dependency Name="Microsoft.EntityFrameworkCore.Relational" Version="6.0.4">
2121
<Uri>https://dev.azure.com/dnceng/internal/_git/dotnet-efcore</Uri>
22-
<Sha>0257e5c118d78ce1b4d5e514779240c929c4b8aa</Sha>
22+
<Sha>aca50aef8604cc23910d18edce820e0fa7c61910</Sha>
2323
</Dependency>
24-
<Dependency Name="Microsoft.EntityFrameworkCore.Sqlite" Version="6.0.3">
24+
<Dependency Name="Microsoft.EntityFrameworkCore.Sqlite" Version="6.0.4">
2525
<Uri>https://dev.azure.com/dnceng/internal/_git/dotnet-efcore</Uri>
26-
<Sha>0257e5c118d78ce1b4d5e514779240c929c4b8aa</Sha>
26+
<Sha>aca50aef8604cc23910d18edce820e0fa7c61910</Sha>
2727
</Dependency>
28-
<Dependency Name="Microsoft.EntityFrameworkCore.SqlServer" Version="6.0.3">
28+
<Dependency Name="Microsoft.EntityFrameworkCore.SqlServer" Version="6.0.4">
2929
<Uri>https://dev.azure.com/dnceng/internal/_git/dotnet-efcore</Uri>
30-
<Sha>0257e5c118d78ce1b4d5e514779240c929c4b8aa</Sha>
30+
<Sha>aca50aef8604cc23910d18edce820e0fa7c61910</Sha>
3131
</Dependency>
32-
<Dependency Name="Microsoft.EntityFrameworkCore.Tools" Version="6.0.3">
32+
<Dependency Name="Microsoft.EntityFrameworkCore.Tools" Version="6.0.4">
3333
<Uri>https://dev.azure.com/dnceng/internal/_git/dotnet-efcore</Uri>
34-
<Sha>0257e5c118d78ce1b4d5e514779240c929c4b8aa</Sha>
34+
<Sha>aca50aef8604cc23910d18edce820e0fa7c61910</Sha>
3535
</Dependency>
36-
<Dependency Name="Microsoft.EntityFrameworkCore" Version="6.0.3">
36+
<Dependency Name="Microsoft.EntityFrameworkCore" Version="6.0.4">
3737
<Uri>https://dev.azure.com/dnceng/internal/_git/dotnet-efcore</Uri>
38-
<Sha>0257e5c118d78ce1b4d5e514779240c929c4b8aa</Sha>
38+
<Sha>aca50aef8604cc23910d18edce820e0fa7c61910</Sha>
3939
</Dependency>
40-
<Dependency Name="Microsoft.EntityFrameworkCore.Design" Version="6.0.3">
40+
<Dependency Name="Microsoft.EntityFrameworkCore.Design" Version="6.0.4">
4141
<Uri>https://dev.azure.com/dnceng/internal/_git/dotnet-efcore</Uri>
42-
<Sha>0257e5c118d78ce1b4d5e514779240c929c4b8aa</Sha>
42+
<Sha>aca50aef8604cc23910d18edce820e0fa7c61910</Sha>
4343
</Dependency>
4444
<Dependency Name="Microsoft.Extensions.Caching.Abstractions" Version="6.0.0">
4545
<Uri>https://github.com/dotnet/runtime</Uri>
@@ -177,9 +177,9 @@
177177
<Uri>https://github.com/dotnet/runtime</Uri>
178178
<Sha>4822e3c3aa77eb82b2fb33c9321f923cf11ddde6</Sha>
179179
</Dependency>
180-
<Dependency Name="Microsoft.Internal.Runtime.AspNetCore.Transport" Version="6.0.3-servicing.22123.9">
180+
<Dependency Name="Microsoft.Internal.Runtime.AspNetCore.Transport" Version="6.0.4-servicing.22164.4">
181181
<Uri>https://dev.azure.com/dnceng/internal/_git/dotnet-runtime</Uri>
182-
<Sha>c24d9a9c91c5d04b7b4de71f1a9f33ac35e09663</Sha>
182+
<Sha>be98e88c760526452df94ef452fff4602fb5bded</Sha>
183183
</Dependency>
184184
<Dependency Name="System.Diagnostics.DiagnosticSource" Version="6.0.0">
185185
<Uri>https://github.com/dotnet/runtime</Uri>
@@ -201,9 +201,9 @@
201201
<Uri>https://github.com/dotnet/runtime</Uri>
202202
<Sha>4822e3c3aa77eb82b2fb33c9321f923cf11ddde6</Sha>
203203
</Dependency>
204-
<Dependency Name="System.Net.Http.WinHttpHandler" Version="6.0.0">
205-
<Uri>https://github.com/dotnet/runtime</Uri>
206-
<Sha>4822e3c3aa77eb82b2fb33c9321f923cf11ddde6</Sha>
204+
<Dependency Name="System.Net.Http.WinHttpHandler" Version="6.0.1">
205+
<Uri>https://dev.azure.com/dnceng/internal/_git/dotnet-runtime</Uri>
206+
<Sha>be98e88c760526452df94ef452fff4602fb5bded</Sha>
207207
</Dependency>
208208
<Dependency Name="System.Reflection.Metadata" Version="6.0.1">
209209
<Uri>https://dev.azure.com/dnceng/internal/_git/dotnet-runtime</Uri>
@@ -233,9 +233,9 @@
233233
<Uri>https://github.com/dotnet/runtime</Uri>
234234
<Sha>4822e3c3aa77eb82b2fb33c9321f923cf11ddde6</Sha>
235235
</Dependency>
236-
<Dependency Name="System.Text.Json" Version="6.0.2">
236+
<Dependency Name="System.Text.Json" Version="6.0.3">
237237
<Uri>https://dev.azure.com/dnceng/internal/_git/dotnet-runtime</Uri>
238-
<Sha>839cdfb0ecca5e0be3dbccd926e7651ef50fdf10</Sha>
238+
<Sha>be98e88c760526452df94ef452fff4602fb5bded</Sha>
239239
</Dependency>
240240
<Dependency Name="System.Threading.Channels" Version="6.0.0">
241241
<Uri>https://github.com/dotnet/runtime</Uri>
@@ -245,40 +245,40 @@
245245
<Uri>https://github.com/dotnet/runtime</Uri>
246246
<Sha>4822e3c3aa77eb82b2fb33c9321f923cf11ddde6</Sha>
247247
</Dependency>
248-
<Dependency Name="Microsoft.NETCore.App.Ref" Version="6.0.3">
248+
<Dependency Name="Microsoft.NETCore.App.Ref" Version="6.0.4">
249249
<Uri>https://dev.azure.com/dnceng/internal/_git/dotnet-runtime</Uri>
250-
<Sha>c24d9a9c91c5d04b7b4de71f1a9f33ac35e09663</Sha>
250+
<Sha>be98e88c760526452df94ef452fff4602fb5bded</Sha>
251251
</Dependency>
252-
<Dependency Name="Microsoft.NET.Runtime.MonoAOTCompiler.Task" Version="6.0.3">
252+
<Dependency Name="Microsoft.NET.Runtime.MonoAOTCompiler.Task" Version="6.0.4">
253253
<Uri>https://dev.azure.com/dnceng/internal/_git/dotnet-runtime</Uri>
254-
<Sha>c24d9a9c91c5d04b7b4de71f1a9f33ac35e09663</Sha>
254+
<Sha>be98e88c760526452df94ef452fff4602fb5bded</Sha>
255255
</Dependency>
256-
<Dependency Name="Microsoft.NET.Runtime.WebAssembly.Sdk" Version="6.0.3">
256+
<Dependency Name="Microsoft.NET.Runtime.WebAssembly.Sdk" Version="6.0.4">
257257
<Uri>https://dev.azure.com/dnceng/internal/_git/dotnet-runtime</Uri>
258-
<Sha>c24d9a9c91c5d04b7b4de71f1a9f33ac35e09663</Sha>
258+
<Sha>be98e88c760526452df94ef452fff4602fb5bded</Sha>
259259
</Dependency>
260260
<!--
261261
Win-x64 is used here because we have picked an arbitrary runtime identifier to flow the version of the latest NETCore.App runtime.
262262
All Runtime.$rid packages should have the same version.
263263
-->
264-
<Dependency Name="Microsoft.NETCore.App.Runtime.win-x64" Version="6.0.3">
264+
<Dependency Name="Microsoft.NETCore.App.Runtime.win-x64" Version="6.0.4">
265265
<Uri>https://dev.azure.com/dnceng/internal/_git/dotnet-runtime</Uri>
266-
<Sha>c24d9a9c91c5d04b7b4de71f1a9f33ac35e09663</Sha>
266+
<Sha>be98e88c760526452df94ef452fff4602fb5bded</Sha>
267267
</Dependency>
268-
<Dependency Name="Microsoft.NETCore.App.Runtime.AOT.win-x64.Cross.browser-wasm" Version="6.0.3">
268+
<Dependency Name="Microsoft.NETCore.App.Runtime.AOT.win-x64.Cross.browser-wasm" Version="6.0.4">
269269
<Uri>https://dev.azure.com/dnceng/internal/_git/dotnet-runtime</Uri>
270-
<Sha>c24d9a9c91c5d04b7b4de71f1a9f33ac35e09663</Sha>
270+
<Sha>be98e88c760526452df94ef452fff4602fb5bded</Sha>
271271
</Dependency>
272-
<Dependency Name="Microsoft.NETCore.BrowserDebugHost.Transport" Version="6.0.3-servicing.22123.9">
272+
<Dependency Name="Microsoft.NETCore.BrowserDebugHost.Transport" Version="6.0.4-servicing.22164.4">
273273
<Uri>https://dev.azure.com/dnceng/internal/_git/dotnet-runtime</Uri>
274-
<Sha>c24d9a9c91c5d04b7b4de71f1a9f33ac35e09663</Sha>
274+
<Sha>be98e88c760526452df94ef452fff4602fb5bded</Sha>
275275
</Dependency>
276276
</ProductDependencies>
277277
<ToolsetDependencies>
278278
<!-- Listed explicitly to workaround https://github.com/dotnet/cli/issues/10528 -->
279-
<Dependency Name="Microsoft.NETCore.Platforms" Version="6.0.2">
279+
<Dependency Name="Microsoft.NETCore.Platforms" Version="6.0.3">
280280
<Uri>https://dev.azure.com/dnceng/internal/_git/dotnet-runtime</Uri>
281-
<Sha>c24d9a9c91c5d04b7b4de71f1a9f33ac35e09663</Sha>
281+
<Sha>be98e88c760526452df94ef452fff4602fb5bded</Sha>
282282
</Dependency>
283283
<Dependency Name="Microsoft.DotNet.Arcade.Sdk" Version="6.0.0-beta.22206.7">
284284
<Uri>https://github.com/dotnet/arcade</Uri>

eng/Versions.props

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -63,12 +63,12 @@
6363
<PropertyGroup Label="Automated">
6464
<!-- Packages from dotnet/runtime -->
6565
<MicrosoftExtensionsDependencyModelVersion>6.0.0</MicrosoftExtensionsDependencyModelVersion>
66-
<MicrosoftNETCoreAppRefVersion>6.0.3</MicrosoftNETCoreAppRefVersion>
67-
<MicrosoftNETCoreAppRuntimewinx64Version>6.0.3</MicrosoftNETCoreAppRuntimewinx64Version>
68-
<MicrosoftNETRuntimeMonoAOTCompilerTaskVersion>6.0.3</MicrosoftNETRuntimeMonoAOTCompilerTaskVersion>
69-
<MicrosoftNETRuntimeWebAssemblySdkVersion>6.0.3</MicrosoftNETRuntimeWebAssemblySdkVersion>
70-
<MicrosoftNETCoreAppRuntimeAOTwinx64CrossbrowserwasmVersion>6.0.3</MicrosoftNETCoreAppRuntimeAOTwinx64CrossbrowserwasmVersion>
71-
<MicrosoftNETCoreBrowserDebugHostTransportVersion>6.0.3-servicing.22123.9</MicrosoftNETCoreBrowserDebugHostTransportVersion>
66+
<MicrosoftNETCoreAppRefVersion>6.0.4</MicrosoftNETCoreAppRefVersion>
67+
<MicrosoftNETCoreAppRuntimewinx64Version>6.0.4</MicrosoftNETCoreAppRuntimewinx64Version>
68+
<MicrosoftNETRuntimeMonoAOTCompilerTaskVersion>6.0.4</MicrosoftNETRuntimeMonoAOTCompilerTaskVersion>
69+
<MicrosoftNETRuntimeWebAssemblySdkVersion>6.0.4</MicrosoftNETRuntimeWebAssemblySdkVersion>
70+
<MicrosoftNETCoreAppRuntimeAOTwinx64CrossbrowserwasmVersion>6.0.4</MicrosoftNETCoreAppRuntimeAOTwinx64CrossbrowserwasmVersion>
71+
<MicrosoftNETCoreBrowserDebugHostTransportVersion>6.0.4-servicing.22164.4</MicrosoftNETCoreBrowserDebugHostTransportVersion>
7272
<MicrosoftExtensionsCachingAbstractionsVersion>6.0.0</MicrosoftExtensionsCachingAbstractionsVersion>
7373
<MicrosoftExtensionsCachingMemoryVersion>6.0.1</MicrosoftExtensionsCachingMemoryVersion>
7474
<MicrosoftExtensionsConfigurationAbstractionsVersion>6.0.0</MicrosoftExtensionsConfigurationAbstractionsVersion>
@@ -103,33 +103,33 @@
103103
<MicrosoftExtensionsOptionsDataAnnotationsVersion>6.0.0</MicrosoftExtensionsOptionsDataAnnotationsVersion>
104104
<MicrosoftExtensionsOptionsVersion>6.0.0</MicrosoftExtensionsOptionsVersion>
105105
<MicrosoftExtensionsPrimitivesVersion>6.0.0</MicrosoftExtensionsPrimitivesVersion>
106-
<MicrosoftInternalRuntimeAspNetCoreTransportVersion>6.0.3-servicing.22123.9</MicrosoftInternalRuntimeAspNetCoreTransportVersion>
106+
<MicrosoftInternalRuntimeAspNetCoreTransportVersion>6.0.4-servicing.22164.4</MicrosoftInternalRuntimeAspNetCoreTransportVersion>
107107
<SystemDiagnosticsDiagnosticSourceVersion>6.0.0</SystemDiagnosticsDiagnosticSourceVersion>
108108
<SystemDiagnosticsEventLogVersion>6.0.0</SystemDiagnosticsEventLogVersion>
109109
<SystemDirectoryServicesProtocolsVersion>6.0.1</SystemDirectoryServicesProtocolsVersion>
110110
<SystemIOPipelinesVersion>6.0.2</SystemIOPipelinesVersion>
111111
<SystemNetHttpJsonVersion>6.0.0</SystemNetHttpJsonVersion>
112-
<SystemNetHttpWinHttpHandlerVersion>6.0.0</SystemNetHttpWinHttpHandlerVersion>
112+
<SystemNetHttpWinHttpHandlerVersion>6.0.1</SystemNetHttpWinHttpHandlerVersion>
113113
<SystemReflectionMetadataVersion>6.0.1</SystemReflectionMetadataVersion>
114114
<SystemResourcesExtensionsVersion>6.0.0</SystemResourcesExtensionsVersion>
115115
<SystemRuntimeCompilerServicesUnsafeVersion>6.0.0</SystemRuntimeCompilerServicesUnsafeVersion>
116116
<SystemSecurityCryptographyPkcsVersion>6.0.0</SystemSecurityCryptographyPkcsVersion>
117117
<SystemSecurityCryptographyXmlVersion>6.0.0</SystemSecurityCryptographyXmlVersion>
118118
<SystemServiceProcessServiceControllerVersion>6.0.0</SystemServiceProcessServiceControllerVersion>
119119
<SystemTextEncodingsWebVersion>6.0.0</SystemTextEncodingsWebVersion>
120-
<SystemTextJsonVersion>6.0.2</SystemTextJsonVersion>
120+
<SystemTextJsonVersion>6.0.3</SystemTextJsonVersion>
121121
<SystemThreadingChannelsVersion>6.0.0</SystemThreadingChannelsVersion>
122122
<!-- Only listed explicitly to workaround https://github.com/dotnet/cli/issues/10528 -->
123-
<MicrosoftNETCorePlatformsVersion>6.0.2</MicrosoftNETCorePlatformsVersion>
123+
<MicrosoftNETCorePlatformsVersion>6.0.3</MicrosoftNETCorePlatformsVersion>
124124
<!-- Packages from dotnet/efcore -->
125-
<dotnetefVersion>6.0.3</dotnetefVersion>
126-
<MicrosoftEntityFrameworkCoreInMemoryVersion>6.0.3</MicrosoftEntityFrameworkCoreInMemoryVersion>
127-
<MicrosoftEntityFrameworkCoreRelationalVersion>6.0.3</MicrosoftEntityFrameworkCoreRelationalVersion>
128-
<MicrosoftEntityFrameworkCoreSqliteVersion>6.0.3</MicrosoftEntityFrameworkCoreSqliteVersion>
129-
<MicrosoftEntityFrameworkCoreSqlServerVersion>6.0.3</MicrosoftEntityFrameworkCoreSqlServerVersion>
130-
<MicrosoftEntityFrameworkCoreToolsVersion>6.0.3</MicrosoftEntityFrameworkCoreToolsVersion>
131-
<MicrosoftEntityFrameworkCoreVersion>6.0.3</MicrosoftEntityFrameworkCoreVersion>
132-
<MicrosoftEntityFrameworkCoreDesignVersion>6.0.3</MicrosoftEntityFrameworkCoreDesignVersion>
125+
<dotnetefVersion>6.0.4</dotnetefVersion>
126+
<MicrosoftEntityFrameworkCoreInMemoryVersion>6.0.4</MicrosoftEntityFrameworkCoreInMemoryVersion>
127+
<MicrosoftEntityFrameworkCoreRelationalVersion>6.0.4</MicrosoftEntityFrameworkCoreRelationalVersion>
128+
<MicrosoftEntityFrameworkCoreSqliteVersion>6.0.4</MicrosoftEntityFrameworkCoreSqliteVersion>
129+
<MicrosoftEntityFrameworkCoreSqlServerVersion>6.0.4</MicrosoftEntityFrameworkCoreSqlServerVersion>
130+
<MicrosoftEntityFrameworkCoreToolsVersion>6.0.4</MicrosoftEntityFrameworkCoreToolsVersion>
131+
<MicrosoftEntityFrameworkCoreVersion>6.0.4</MicrosoftEntityFrameworkCoreVersion>
132+
<MicrosoftEntityFrameworkCoreDesignVersion>6.0.4</MicrosoftEntityFrameworkCoreDesignVersion>
133133
<!-- Packages from dotnet/arcade -->
134134
<MicrosoftDotNetBuildTasksInstallersVersion>6.0.0-beta.22206.7</MicrosoftDotNetBuildTasksInstallersVersion>
135135
<MicrosoftDotNetBuildTasksTemplatingVersion>6.0.0-beta.22206.7</MicrosoftDotNetBuildTasksTemplatingVersion>

eng/helix/helix.proj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
not HelixCorrelationPayload.
1111
-->
1212
<PropertyGroup>
13-
<IsPublicRuntime>true</IsPublicRuntime>
13+
<IsPublicRuntime>false</IsPublicRuntime>
1414
</PropertyGroup>
1515

1616
<PropertyGroup>

src/DefaultBuilder/src/WebApplicationBuilder.cs

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ public sealed class WebApplicationBuilder
2222
private readonly BootstrapHostBuilder _bootstrapHostBuilder;
2323
private readonly WebApplicationServiceCollection _services = new();
2424
private readonly List<KeyValuePair<string, string>> _hostConfigurationValues;
25+
private readonly ConfigurationManager _hostConfigurationManager = new();
2526

2627
private WebApplication? _builtApplication;
2728

@@ -76,6 +77,8 @@ internal WebApplicationBuilder(WebApplicationOptions options, Action<IHostBuilde
7677
});
7778

7879
Configuration = new();
80+
// This is chained as the first configuration source in Configuration so host config can be added later without overriding app config.
81+
Configuration.AddConfiguration(_hostConfigurationManager);
7982

8083
// Collect the hosted services separately since we want those to run after the user's hosted services
8184
_services.TrackHostedServices = true;
@@ -194,22 +197,32 @@ public WebApplication Build()
194197
// to the new one. This allows code that has references to the service collection to still function.
195198
_services.InnerCollection = services;
196199

200+
// Keep any configuration sources added before the TrackingChainedConfigurationSource (namely host configuration from _hostConfigurationValues)
201+
// from overriding config values set via Configuration by inserting them at beginning using _hostConfigurationValues.
202+
var beforeChainedConfig = true;
197203
var hostBuilderProviders = ((IConfigurationRoot)context.Configuration).Providers;
198204

199205
if (!hostBuilderProviders.Contains(chainedConfigSource.BuiltProvider))
200206
{
201207
// Something removed the _hostBuilder's TrackingChainedConfigurationSource pointing back to the ConfigurationManager.
202208
// This is likely a test using WebApplicationFactory. Replicate the effect by clearing the ConfingurationManager sources.
203209
((IConfigurationBuilder)Configuration).Sources.Clear();
210+
beforeChainedConfig = false;
204211
}
205212

206-
// Make builder.Configuration match the final configuration. To do that, we add the additional
207-
// providers in the inner _hostBuilders's Configuration to the ConfigurationManager.
213+
// Make the ConfigurationManager match the final _hostBuilder's configuration. To do that, we add the additional providers
214+
// to the inner _hostBuilders's configuration to the ConfigurationManager. We wrap the existing provider in a
215+
// configuration source to avoid rebuilding or reloading the already added configuration sources.
208216
foreach (var provider in hostBuilderProviders)
209217
{
210-
if (!ReferenceEquals(provider, chainedConfigSource.BuiltProvider))
218+
if (ReferenceEquals(provider, chainedConfigSource.BuiltProvider))
211219
{
212-
((IConfigurationBuilder)Configuration).Add(new ConfigurationProviderSource(provider));
220+
beforeChainedConfig = false;
221+
}
222+
else
223+
{
224+
IConfigurationBuilder configBuilder = beforeChainedConfig ? _hostConfigurationManager : Configuration;
225+
configBuilder.Add(new ConfigurationProviderSource(provider));
213226
}
214227
}
215228
});

0 commit comments

Comments
 (0)