From 40507092f06c69f0e1fa76d2cc74ed88546775aa Mon Sep 17 00:00:00 2001 From: Genevieve Warren <24882762+gewarren@users.noreply.github.com> Date: Mon, 5 Aug 2024 12:55:38 -0700 Subject: [PATCH] HostBuilder validation enabled --- docs/core/compatibility/9.0.md | 1 + .../aspnet-core/9.0/hostbuilder-validation.md | 37 +++++++++++++++++++ docs/core/compatibility/toc.yml | 4 ++ 3 files changed, 42 insertions(+) create mode 100644 docs/core/compatibility/aspnet-core/9.0/hostbuilder-validation.md diff --git a/docs/core/compatibility/9.0.md b/docs/core/compatibility/9.0.md index c9cd0cf2bcac7..600b6335984c2 100644 --- a/docs/core/compatibility/9.0.md +++ b/docs/core/compatibility/9.0.md @@ -20,6 +20,7 @@ If you're migrating an app to .NET 9, the breaking changes listed here might aff | Title | Type of change | Introduced version | |------------------------------------------------------------------------------------------|---------------------|--------------------| | [DefaultKeyResolution.ShouldGenerateNewKey has altered meaning](aspnet-core/9.0/key-resolution.md) | Behavioral change | Preview 3 | +| [HostBuilder enables ValidateOnBuild/ValidateScopes in development environment](aspnet-core/9.0/hostbuilder-validation.md) | Behavioral change | Preview 7 | ## Core .NET libraries diff --git a/docs/core/compatibility/aspnet-core/9.0/hostbuilder-validation.md b/docs/core/compatibility/aspnet-core/9.0/hostbuilder-validation.md new file mode 100644 index 0000000000000..0a2c4c53e2a52 --- /dev/null +++ b/docs/core/compatibility/aspnet-core/9.0/hostbuilder-validation.md @@ -0,0 +1,37 @@ +--- +title: "Breaking change: HostBuilder enables ValidateOnBuild/ValidateScopes in development environment" +description: Learn about the breaking change in .NET 9 where HostBuilder now enables ValidateOnBuild and ValidateScopes in the development environment. +ms.date: 08/05/2024 +--- +# HostBuilder enables ValidateOnBuild/ValidateScopes in development environment + +Previously, no validation was enabled by default. Now, in the [development environment](/aspnet/core/fundamentals/environments), and are enabled. + +## Version introduced + +.NET 9 Preview 7 + +## Previous behavior + + and defaulted to `false` and were only enabled when they were explicitly set by calling . + +## New behavior + +In the [development environment](/aspnet/core/fundamentals/environments) when options haven't been set with , and are set to `true`. + +## Type of breaking change + +This change is a [behavioral change](../../categories.md#behavioral-change). + +## Reason for 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. + +## Recommended action + +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 . + +## Affected APIs + +- +- diff --git a/docs/core/compatibility/toc.yml b/docs/core/compatibility/toc.yml index 316284b9b5100..5b6904b294b19 100644 --- a/docs/core/compatibility/toc.yml +++ b/docs/core/compatibility/toc.yml @@ -12,6 +12,8 @@ items: items: - name: DefaultKeyResolution.ShouldGenerateNewKey has altered meaning href: aspnet-core/9.0/key-resolution.md + - name: HostBuilder enables ValidateOnBuild/ValidateScopes in development environment + href: aspnet-core/9.0/hostbuilder-validation.md - name: Core .NET libraries items: - name: Adding a ZipArchiveEntry sets header general-purpose bit flags @@ -958,6 +960,8 @@ items: items: - name: DefaultKeyResolution.ShouldGenerateNewKey has altered meaning href: aspnet-core/9.0/key-resolution.md + - name: HostBuilder enables ValidateOnBuild/ValidateScopes in development environment + href: aspnet-core/9.0/hostbuilder-validation.md - name: .NET 8 items: - name: ConcurrencyLimiterMiddleware is obsolete