aspnetcore/breaking-changes/9/hostbuilder-validation.md
Previously, no validation was enabled by default. Now, in the development environment, xref:Microsoft.Extensions.DependencyInjection.ServiceProviderOptions.ValidateOnBuild and xref:Microsoft.Extensions.DependencyInjection.ServiceProviderOptions.ValidateScopes are enabled.
.NET 9 Preview 7
xref:Microsoft.Extensions.DependencyInjection.ServiceProviderOptions.ValidateOnBuild and xref:Microsoft.Extensions.DependencyInjection.ServiceProviderOptions.ValidateScopes defaulted to false and were only enabled when they were explicitly set by calling xref:Microsoft.AspNetCore.Hosting.WebHostBuilderExtensions.UseDefaultServiceProvider%2A.
In the development environment when options haven't been set with xref:Microsoft.AspNetCore.Hosting.WebHostBuilderExtensions.UseDefaultServiceProvider%2A, xref:Microsoft.Extensions.DependencyInjection.ServiceProviderOptions.ValidateOnBuild and xref:Microsoft.Extensions.DependencyInjection.ServiceProviderOptions.ValidateScopes are set to true.
This change is a behavioral change.
Validation helps to catch problems early in application startup rather than later (or not at all) when the application interacts with its service provider.
No action necessary if your application validates successfully. If you do see a validation error when testing in development, first try to fix it. If you can't fix it, you can disable validation by calling xref:Microsoft.AspNetCore.Hosting.WebHostBuilderExtensions.UseDefaultServiceProvider%2A.