Improve HostBuilder and WebApplicationBuilder ServiceCollection integration #61635
Labels
api-suggestion
Early API idea and discussion, it is NOT ready for implementation
area-Extensions-Hosting
Milestone
Today
WebApplicationBuilder
has some hacky logic to synchronize theWebApplicationBuilder.Services
IServiceCollection
and theHostBuilder
'sIServiceCollection
in case any custom services have been added via HostFactoryResolver. This logic can be found here.The synchronization is not perfect and can lead to bugs like the following throwing even though the equivalent would work in
Startup.ConfigureServices
when using theHostBuilder
directly.We should look into adding an API to
HostBuilder
to share anIServiceCollection
with theWebApplicationBuilder
.Related: #61634
The text was updated successfully, but these errors were encountered: