Skip to content

Commit 7a3f9fe

Browse files
authored
Merge pull request #32002 from dotnet-maestro-bot/merge/release/6.0-preview4-to-main
[automated] Merge branch 'release/6.0-preview4' => 'main'
2 parents 97d3d29 + 926ad9b commit 7a3f9fe

File tree

115 files changed

+4714
-341
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

115 files changed

+4714
-341
lines changed

AspNetCore.sln

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1626,6 +1626,14 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Microsoft.AspNetCore.SpaSer
16261626
EndProject
16271627
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "MinimalSample", "src\Http\samples\MinimalSample\MinimalSample.csproj", "{9647D8B7-4616-4E05-B258-BAD5CAEEDD38}"
16281628
EndProject
1629+
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "HttpLogging", "HttpLogging", "{022B4B80-E813-4256-8034-11A68146F4EF}"
1630+
EndProject
1631+
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.AspNetCore.HttpLogging", "src\Middleware\HttpLogging\src\Microsoft.AspNetCore.HttpLogging.csproj", "{FF413F1C-A998-4FA2-823F-52AC0916B35C}"
1632+
EndProject
1633+
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.AspNetCore.HttpLogging.Tests", "src\Middleware\HttpLogging\test\Microsoft.AspNetCore.HttpLogging.Tests.csproj", "{3A1EC883-EF9C-43E8-95E5-6B527428867B}"
1634+
EndProject
1635+
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "HttpLogging.Sample", "src\Middleware\HttpLogging\samples\HttpLogging.Sample\HttpLogging.Sample.csproj", "{908B2263-B58B-4261-A125-B5F2DFF92799}"
1636+
EndProject
16291637
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.AspNetCore.Server.Kestrel.Transport.Quic.Tests", "src\Servers\Kestrel\Transport.Quic\test\Microsoft.AspNetCore.Server.Kestrel.Transport.Quic.Tests.csproj", "{E3DAEBD3-CD36-493F-877F-460E8FFEAC52}"
16301638
EndProject
16311639
Global
@@ -7711,6 +7719,42 @@ Global
77117719
{9647D8B7-4616-4E05-B258-BAD5CAEEDD38}.Release|x64.Build.0 = Release|Any CPU
77127720
{9647D8B7-4616-4E05-B258-BAD5CAEEDD38}.Release|x86.ActiveCfg = Release|Any CPU
77137721
{9647D8B7-4616-4E05-B258-BAD5CAEEDD38}.Release|x86.Build.0 = Release|Any CPU
7722+
{FF413F1C-A998-4FA2-823F-52AC0916B35C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
7723+
{FF413F1C-A998-4FA2-823F-52AC0916B35C}.Debug|Any CPU.Build.0 = Debug|Any CPU
7724+
{FF413F1C-A998-4FA2-823F-52AC0916B35C}.Debug|x64.ActiveCfg = Debug|Any CPU
7725+
{FF413F1C-A998-4FA2-823F-52AC0916B35C}.Debug|x64.Build.0 = Debug|Any CPU
7726+
{FF413F1C-A998-4FA2-823F-52AC0916B35C}.Debug|x86.ActiveCfg = Debug|Any CPU
7727+
{FF413F1C-A998-4FA2-823F-52AC0916B35C}.Debug|x86.Build.0 = Debug|Any CPU
7728+
{FF413F1C-A998-4FA2-823F-52AC0916B35C}.Release|Any CPU.ActiveCfg = Release|Any CPU
7729+
{FF413F1C-A998-4FA2-823F-52AC0916B35C}.Release|Any CPU.Build.0 = Release|Any CPU
7730+
{FF413F1C-A998-4FA2-823F-52AC0916B35C}.Release|x64.ActiveCfg = Release|Any CPU
7731+
{FF413F1C-A998-4FA2-823F-52AC0916B35C}.Release|x64.Build.0 = Release|Any CPU
7732+
{FF413F1C-A998-4FA2-823F-52AC0916B35C}.Release|x86.ActiveCfg = Release|Any CPU
7733+
{FF413F1C-A998-4FA2-823F-52AC0916B35C}.Release|x86.Build.0 = Release|Any CPU
7734+
{3A1EC883-EF9C-43E8-95E5-6B527428867B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
7735+
{3A1EC883-EF9C-43E8-95E5-6B527428867B}.Debug|Any CPU.Build.0 = Debug|Any CPU
7736+
{3A1EC883-EF9C-43E8-95E5-6B527428867B}.Debug|x64.ActiveCfg = Debug|Any CPU
7737+
{3A1EC883-EF9C-43E8-95E5-6B527428867B}.Debug|x64.Build.0 = Debug|Any CPU
7738+
{3A1EC883-EF9C-43E8-95E5-6B527428867B}.Debug|x86.ActiveCfg = Debug|Any CPU
7739+
{3A1EC883-EF9C-43E8-95E5-6B527428867B}.Debug|x86.Build.0 = Debug|Any CPU
7740+
{3A1EC883-EF9C-43E8-95E5-6B527428867B}.Release|Any CPU.ActiveCfg = Release|Any CPU
7741+
{3A1EC883-EF9C-43E8-95E5-6B527428867B}.Release|Any CPU.Build.0 = Release|Any CPU
7742+
{3A1EC883-EF9C-43E8-95E5-6B527428867B}.Release|x64.ActiveCfg = Release|Any CPU
7743+
{3A1EC883-EF9C-43E8-95E5-6B527428867B}.Release|x64.Build.0 = Release|Any CPU
7744+
{3A1EC883-EF9C-43E8-95E5-6B527428867B}.Release|x86.ActiveCfg = Release|Any CPU
7745+
{3A1EC883-EF9C-43E8-95E5-6B527428867B}.Release|x86.Build.0 = Release|Any CPU
7746+
{908B2263-B58B-4261-A125-B5F2DFF92799}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
7747+
{908B2263-B58B-4261-A125-B5F2DFF92799}.Debug|Any CPU.Build.0 = Debug|Any CPU
7748+
{908B2263-B58B-4261-A125-B5F2DFF92799}.Debug|x64.ActiveCfg = Debug|Any CPU
7749+
{908B2263-B58B-4261-A125-B5F2DFF92799}.Debug|x64.Build.0 = Debug|Any CPU
7750+
{908B2263-B58B-4261-A125-B5F2DFF92799}.Debug|x86.ActiveCfg = Debug|Any CPU
7751+
{908B2263-B58B-4261-A125-B5F2DFF92799}.Debug|x86.Build.0 = Debug|Any CPU
7752+
{908B2263-B58B-4261-A125-B5F2DFF92799}.Release|Any CPU.ActiveCfg = Release|Any CPU
7753+
{908B2263-B58B-4261-A125-B5F2DFF92799}.Release|Any CPU.Build.0 = Release|Any CPU
7754+
{908B2263-B58B-4261-A125-B5F2DFF92799}.Release|x64.ActiveCfg = Release|Any CPU
7755+
{908B2263-B58B-4261-A125-B5F2DFF92799}.Release|x64.Build.0 = Release|Any CPU
7756+
{908B2263-B58B-4261-A125-B5F2DFF92799}.Release|x86.ActiveCfg = Release|Any CPU
7757+
{908B2263-B58B-4261-A125-B5F2DFF92799}.Release|x86.Build.0 = Release|Any CPU
77147758
{E3DAEBD3-CD36-493F-877F-460E8FFEAC52}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
77157759
{E3DAEBD3-CD36-493F-877F-460E8FFEAC52}.Debug|Any CPU.Build.0 = Debug|Any CPU
77167760
{E3DAEBD3-CD36-493F-877F-460E8FFEAC52}.Debug|x64.ActiveCfg = Debug|Any CPU
@@ -8528,6 +8572,10 @@ Global
85288572
{DF4637DA-5F07-4903-8461-4E2DAB235F3C} = {7F99E967-3DC1-4198-9D55-47CD9471D0B6}
85298573
{AAB50C64-39AA-4AED-8E9C-50D68E7751AD} = {7F99E967-3DC1-4198-9D55-47CD9471D0B6}
85308574
{9647D8B7-4616-4E05-B258-BAD5CAEEDD38} = {EB5E294B-9ED5-43BF-AFA9-1CD2327F3DC1}
8575+
{022B4B80-E813-4256-8034-11A68146F4EF} = {E5963C9F-20A6-4385-B364-814D2581FADF}
8576+
{FF413F1C-A998-4FA2-823F-52AC0916B35C} = {022B4B80-E813-4256-8034-11A68146F4EF}
8577+
{3A1EC883-EF9C-43E8-95E5-6B527428867B} = {022B4B80-E813-4256-8034-11A68146F4EF}
8578+
{908B2263-B58B-4261-A125-B5F2DFF92799} = {022B4B80-E813-4256-8034-11A68146F4EF}
85318579
{E3DAEBD3-CD36-493F-877F-460E8FFEAC52} = {EE9D0952-6060-4723-B329-94A2950A6762}
85328580
EndGlobalSection
85338581
GlobalSection(ExtensibilityGlobals) = postSolution

eng/ProjectReferences.props

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,7 @@
8383
<ProjectReferenceProvider Include="Microsoft.Extensions.Diagnostics.HealthChecks.EntityFrameworkCore" ProjectPath="$(RepoRoot)src\Middleware\HealthChecks.EntityFrameworkCore\src\Microsoft.Extensions.Diagnostics.HealthChecks.EntityFrameworkCore.csproj" />
8484
<ProjectReferenceProvider Include="Microsoft.AspNetCore.Diagnostics.HealthChecks" ProjectPath="$(RepoRoot)src\Middleware\HealthChecks\src\Microsoft.AspNetCore.Diagnostics.HealthChecks.csproj" />
8585
<ProjectReferenceProvider Include="Microsoft.AspNetCore.HostFiltering" ProjectPath="$(RepoRoot)src\Middleware\HostFiltering\src\Microsoft.AspNetCore.HostFiltering.csproj" />
86+
<ProjectReferenceProvider Include="Microsoft.AspNetCore.HttpLogging" ProjectPath="$(RepoRoot)src\Middleware\HttpLogging\src\Microsoft.AspNetCore.HttpLogging.csproj" />
8687
<ProjectReferenceProvider Include="Microsoft.AspNetCore.HttpOverrides" ProjectPath="$(RepoRoot)src\Middleware\HttpOverrides\src\Microsoft.AspNetCore.HttpOverrides.csproj" />
8788
<ProjectReferenceProvider Include="Microsoft.AspNetCore.HttpsPolicy" ProjectPath="$(RepoRoot)src\Middleware\HttpsPolicy\src\Microsoft.AspNetCore.HttpsPolicy.csproj" />
8889
<ProjectReferenceProvider Include="Microsoft.AspNetCore.Localization.Routing" ProjectPath="$(RepoRoot)src\Middleware\Localization.Routing\src\Microsoft.AspNetCore.Localization.Routing.csproj" />

eng/SharedFramework.Local.props

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,7 @@
6969
<AspNetCoreAppReference Include="Microsoft.AspNetCore.Diagnostics" />
7070
<AspNetCoreAppReference Include="Microsoft.AspNetCore.Diagnostics.HealthChecks" />
7171
<AspNetCoreAppReference Include="Microsoft.AspNetCore.HostFiltering" />
72+
<AspNetCoreAppReference Include="Microsoft.AspNetCore.HttpLogging" />
7273
<AspNetCoreAppReference Include="Microsoft.AspNetCore.HttpOverrides" />
7374
<AspNetCoreAppReference Include="Microsoft.AspNetCore.HttpsPolicy" />
7475
<AspNetCoreAppReference Include="Microsoft.AspNetCore.Localization.Routing" />

eng/scripts/CodeCheck.ps1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -211,7 +211,7 @@ try {
211211
$changedAPIBaselines.Add($file)
212212
}
213213
# Check for changes in Unshipped in servicing branches
214-
if ($targetBranch -like 'release*' -and $file -like '*PublicAPI.Unshipped.txt') {
214+
if ($targetBranch -like 'release*' -and $targetBranch -notlike '*preview*' -and $file -like '*PublicAPI.Unshipped.txt') {
215215
$changedAPIBaselines.Add($file)
216216
}
217217
}

src/Components/Components/src/HotReload/HotReloadManager.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,6 @@ public static void DeltaApplied()
2020
OnDeltaApplied?.Invoke();
2121
}
2222

23-
public static void OnAfterUpdate(Type[]? _) => OnDeltaApplied?.Invoke();
23+
public static void AfterUpdate(Type[]? _) => OnDeltaApplied?.Invoke();
2424
}
2525
}

src/Components/WebAssembly/DevServer/src/Server/Startup.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ private static void EnableConfiguredPathbase(IApplicationBuilder app, IConfigura
5858
{
5959
if (context.Request.PathBase == pathBase)
6060
{
61-
return next();
61+
return next(context);
6262
}
6363
else
6464
{

src/Components/WebAssembly/Server/src/ComponentsWebAssemblyApplicationBuilderExtensions.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ public static IApplicationBuilder UseBlazorFrameworkFiles(this IApplicationBuild
5656
context.Response.Headers.Append("DOTNET-MODIFIABLE-ASSEMBLIES", Environment.GetEnvironmentVariable("DOTNET_MODIFIABLE_ASSEMBLIES"));
5757
}
5858

59-
await next();
59+
await next(context);
6060
});
6161

6262
subBuilder.UseMiddleware<ContentEncodingNegotiator>();

src/Components/WebAssembly/Server/src/WebAssemblyNetDebugProxyAppBuilderExtensions.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ public static void UseWebAssemblyDebugging(this IApplicationBuilder app)
2121
{
2222
app.Map("/_framework/debug", app =>
2323
{
24-
app.Use(async (context, next) =>
24+
app.Run(async (context) =>
2525
{
2626
var queryParams = HttpUtility.ParseQueryString(context.Request.QueryString.Value!);
2727
var browserParam = queryParams.Get("browser");

src/Components/WebAssembly/WebAssembly/src/HotReload/WebAssemblyHotReload.cs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -101,20 +101,21 @@ public static void ApplyHotReloadDelta(string moduleIdString, byte[] metadataDel
101101

102102
private static void ApplyUpdate(Assembly assembly, byte[] metadataDelta, byte[] ilDeta)
103103
{
104-
_handlerActions ??= GetMetadataUpdateHandlerActions();
104+
_handlerActions ??= GetMetadataUpdateHandlerActions(AppDomain.CurrentDomain.GetAssemblies());
105105
var (beforeUpdates, afterUpdates) = _handlerActions.Value;
106106

107107
beforeUpdates.ForEach(a => a(null));
108108
System.Reflection.Metadata.AssemblyExtensions.ApplyUpdate(assembly, metadataDelta, ilDeta, ReadOnlySpan<byte>.Empty);
109109
afterUpdates.ForEach(a => a(null));
110110
}
111111

112-
private static (List<Action<Type[]?>> BeforeUpdates, List<Action<Type[]?>> AfterUpdates) GetMetadataUpdateHandlerActions()
112+
// Internal for unit testing.
113+
internal static (List<Action<Type[]?>> BeforeUpdates, List<Action<Type[]?>> AfterUpdates) GetMetadataUpdateHandlerActions(Assembly[] assemblies)
113114
{
114115
var beforeUpdates = new List<Action<Type[]?>>();
115116
var afterUpdates = new List<Action<Type[]?>>();
116117

117-
foreach (var assembly in AppDomain.CurrentDomain.GetAssemblies())
118+
foreach (var assembly in assemblies)
118119
{
119120
foreach (var attribute in assembly.GetCustomAttributes<MetadataUpdateHandlerAttribute>())
120121
{
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
// Copyright (c) .NET Foundation. All rights reserved.
2+
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
3+
4+
using Microsoft.AspNetCore.Components.RenderTree;
5+
using Xunit;
6+
7+
namespace Microsoft.AspNetCore.Components.WebAssembly.HotReload
8+
{
9+
public class WebAssemblyHotReloadTest
10+
{
11+
[Fact]
12+
public void WebAssemblyHotReload_DiscoversMetadataHandlers_FromComponentsAssembly()
13+
{
14+
// Arrange
15+
var assemblies = new[] { typeof(Renderer).Assembly, };
16+
17+
// Act
18+
var (beforeUpdate, afterUpdate) = WebAssemblyHotReload.GetMetadataUpdateHandlerActions(assemblies);
19+
20+
// Assert
21+
Assert.Empty(beforeUpdate);
22+
Assert.Single(afterUpdate);
23+
}
24+
}
25+
}

src/Components/WebAssembly/testassets/HostedInAspNet.Server/Startup.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ public void Configure(IApplicationBuilder app, IWebHostEnvironment env, BootReso
4141
{
4242
bootResourceRequestLog.AddRequest(context.Request);
4343
}
44-
return next();
44+
return next(context);
4545
});
4646

4747
if (env.IsDevelopment())

src/Components/test/testassets/TestServer/ServerStartup.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ public void Configure(IApplicationBuilder app, IWebHostEnvironment env, Resource
4747
resourceRequestLog.AddRequest(context.Request);
4848
}
4949

50-
return next();
50+
return next(context);
5151
});
5252

5353
app.UseStaticFiles();

src/DefaultBuilder/DefaultBuilder.slnf

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,6 @@
55
"src\\DefaultBuilder\\samples\\SampleApp\\DefaultBuilder.SampleApp.csproj",
66
"src\\DefaultBuilder\\test\\Microsoft.AspNetCore.Tests\\Microsoft.AspNetCore.Tests.csproj",
77
"src\\DefaultBuilder\\test\\Microsoft.AspNetCore.FunctionalTests\\Microsoft.AspNetCore.FunctionalTests.csproj",
8-
"src\\DefaultBuilder\\testassets\\CreateDefaultBuilderApp\\CreateDefaultBuilderApp.csproj",
9-
"src\\DefaultBuilder\\testassets\\CreateDefaultBuilderOfTApp\\CreateDefaultBuilderOfTApp.csproj",
10-
"src\\DefaultBuilder\\testassets\\DependencyInjectionApp\\DependencyInjectionApp.csproj",
11-
"src\\DefaultBuilder\\testassets\\StartRequestDelegateUrlApp\\StartRequestDelegateUrlApp.csproj",
12-
"src\\DefaultBuilder\\testassets\\StartRouteBuilderUrlApp\\StartRouteBuilderUrlApp.csproj",
13-
"src\\DefaultBuilder\\testassets\\StartWithIApplicationBuilderUrlApp\\StartWithIApplicationBuilderUrlApp.csproj",
148
"src\\DefaultBuilder\\src\\Microsoft.AspNetCore.csproj",
159
"src\\Hosting\\Server.IntegrationTesting\\src\\Microsoft.AspNetCore.Server.IntegrationTesting.csproj",
1610
"src\\Middleware\\StaticFiles\\src\\Microsoft.AspNetCore.StaticFiles.csproj"

src/DefaultBuilder/samples/SampleApp/Program.cs

Lines changed: 20 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
33

44
using System;
5+
using System.Threading.Tasks;
56
using Microsoft.AspNetCore;
67
using Microsoft.AspNetCore.Builder;
78
using Microsoft.AspNetCore.Hosting;
@@ -14,17 +15,14 @@ namespace SampleApp
1415
{
1516
public class Program
1617
{
17-
public static void Main(string[] args)
18+
public static async Task Main(string[] args)
1819
{
19-
CreateHostBuilder(args).Build().Run();
20-
}
20+
await using var webApp = WebApplication.Create(args);
2121

22-
public static IHostBuilder CreateHostBuilder(string[] args) =>
23-
Host.CreateDefaultBuilder(args)
24-
.ConfigureWebHostDefaults(webBuilder =>
25-
{
26-
webBuilder.UseStartup<Startup>();
27-
});
22+
webApp.MapGet("/", (Func<string>)(() => "Hello, World!"));
23+
24+
await webApp.RunAsync();
25+
}
2826

2927
private static void HelloWorld()
3028
{
@@ -80,8 +78,7 @@ private static void CustomApplicationBuilder()
8078
Console.ReadKey();
8179
}
8280
}
83-
84-
private static void StartupClass(string[] args)
81+
private static void DirectWebHost(string[] args)
8582
{
8683
// Using defaults with a Startup class
8784
using (var host = WebHost.CreateDefaultBuilder(args)
@@ -107,5 +104,17 @@ private static void HostBuilderWithWebHost(string[] args)
107104

108105
host.Run();
109106
}
107+
108+
private static void DefaultGenericHost(string[] args)
109+
{
110+
CreateHostBuilder(args).Build().Run();
111+
}
112+
113+
public static IHostBuilder CreateHostBuilder(string[] args) =>
114+
Host.CreateDefaultBuilder(args)
115+
.ConfigureWebHostDefaults(webBuilder =>
116+
{
117+
webBuilder.UseStartup<Startup>();
118+
});
110119
}
111120
}
Lines changed: 82 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
1+
// Copyright (c) .NET Foundation. All rights reserved.
2+
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
3+
4+
using System;
5+
using System.Collections.Generic;
6+
using Microsoft.AspNetCore.Builder;
7+
using Microsoft.Extensions.Configuration;
8+
using Microsoft.Extensions.DependencyInjection;
9+
using Microsoft.Extensions.Hosting;
10+
11+
namespace Microsoft.AspNetCore.Hosting
12+
{
13+
// This exists solely to bootstrap the configuration
14+
internal class BootstrapHostBuilder : IHostBuilder
15+
{
16+
public IDictionary<object, object> Properties { get; } = new Dictionary<object, object>();
17+
private readonly HostBuilderContext _context;
18+
private readonly Configuration _configuration;
19+
private readonly WebHostEnvironment _environment;
20+
21+
public BootstrapHostBuilder(Configuration configuration, WebHostEnvironment webHostEnvironment)
22+
{
23+
_configuration = configuration;
24+
_environment = webHostEnvironment;
25+
_context = new HostBuilderContext(Properties)
26+
{
27+
Configuration = configuration,
28+
HostingEnvironment = webHostEnvironment
29+
};
30+
}
31+
32+
public IHost Build()
33+
{
34+
// HostingHostBuilderExtensions.ConfigureDefaults should never call this.
35+
throw new InvalidOperationException();
36+
}
37+
38+
public IHostBuilder ConfigureAppConfiguration(Action<HostBuilderContext, IConfigurationBuilder> configureDelegate)
39+
{
40+
configureDelegate(_context, _configuration);
41+
_environment.ApplyConfigurationSettings(_configuration);
42+
_configuration.ChangeBasePath(_environment.ContentRootPath);
43+
return this;
44+
}
45+
46+
public IHostBuilder ConfigureContainer<TContainerBuilder>(Action<HostBuilderContext, TContainerBuilder> configureDelegate)
47+
{
48+
// This is not called by HostingHostBuilderExtensions.ConfigureDefaults currently, but that could change in the future.
49+
// If this does get called in the future, it should be called again at a later stage on the ConfigureHostBuilder.
50+
return this;
51+
}
52+
53+
public IHostBuilder ConfigureHostConfiguration(Action<IConfigurationBuilder> configureDelegate)
54+
{
55+
configureDelegate(_configuration);
56+
_environment.ApplyConfigurationSettings(_configuration);
57+
_configuration.ChangeBasePath(_environment.ContentRootPath);
58+
return this;
59+
}
60+
61+
public IHostBuilder ConfigureServices(Action<HostBuilderContext, IServiceCollection> configureDelegate)
62+
{
63+
// HostingHostBuilderExtensions.ConfigureDefaults calls this via ConfigureLogging
64+
// during the initial config stage. It should be called again later on the ConfigureHostBuilder.
65+
return this;
66+
}
67+
68+
public IHostBuilder UseServiceProviderFactory<TContainerBuilder>(IServiceProviderFactory<TContainerBuilder> factory) where TContainerBuilder : notnull
69+
{
70+
// This is not called by HostingHostBuilderExtensions.ConfigureDefaults currently, but that chould change in the future.
71+
// If this does get called in the future, it should be called again at a later stage on the ConfigureHostBuilder.
72+
return this;
73+
}
74+
75+
public IHostBuilder UseServiceProviderFactory<TContainerBuilder>(Func<HostBuilderContext, IServiceProviderFactory<TContainerBuilder>> factory) where TContainerBuilder : notnull
76+
{
77+
// HostingHostBuilderExtensions.ConfigureDefaults calls this via UseDefaultServiceProvider
78+
// during the initial config stage. It should be called again later on the ConfigureHostBuilder.
79+
return this;
80+
}
81+
}
82+
}

0 commit comments

Comments
 (0)