-
Notifications
You must be signed in to change notification settings - Fork 5.2k
set scope and build validation in dev when no options provided #99199
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 12 commits
1582743
d47722f
a57ab71
81ce220
8651c0a
47a7487
41e5b4a
7649ad3
4ea7d0e
4a4d5b8
9e9e299
b087b83
1861eb3
b7edfa7
4dc5140
1e089c6
c1a7edf
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -37,13 +37,15 @@ public partial class HostBuilder : IHostBuilder | |
| private HostingEnvironment? _hostingEnvironment; | ||
| private IServiceProvider? _appServices; | ||
| private PhysicalFileProvider? _defaultProvider; | ||
| private readonly bool? _defaultProviderFactoryUsed; | ||
|
|
||
| /// <summary> | ||
| /// Initializes a new instance of <see cref="HostBuilder"/>. | ||
| /// </summary> | ||
| public HostBuilder() | ||
| { | ||
| _serviceProviderFactory = new ServiceFactoryAdapter<IServiceCollection>(new DefaultServiceProviderFactory()); | ||
| _defaultProviderFactoryUsed = true; | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Where is this ever set to false? Should that be done in
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes, it seems to me that this field should be set to false when |
||
| } | ||
|
|
||
| /// <summary> | ||
|
|
@@ -349,6 +351,11 @@ private void InitializeServiceProvider() | |
| configureServicesAction(_hostBuilderContext!, services); | ||
| } | ||
|
|
||
| if (_hostBuilderContext!.HostingEnvironment.IsDevelopment() && _defaultProviderFactoryUsed.HasValue && _defaultProviderFactoryUsed.Value) | ||
| { | ||
| _serviceProviderFactory = new ServiceFactoryAdapter<IServiceCollection>(new DefaultServiceProviderFactory(new ServiceProviderOptions { ValidateOnBuild = true, ValidateScopes = true })); | ||
| } | ||
|
|
||
| object containerBuilder = _serviceProviderFactory.CreateBuilder(services); | ||
|
|
||
| foreach (IConfigureContainerAdapter containerAction in _configureContainerActions) | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.