From 474c9a38b1d88b4c6f482dc25523b54f9b90ec95 Mon Sep 17 00:00:00 2001 From: Genevieve Warren <24882762+gewarren@users.noreply.github.com> Date: Thu, 3 Nov 2022 12:12:37 -0700 Subject: [PATCH 1/3] system.diagnostics config entry breaking change --- docs/core/compatibility/7.0.md | 6 ++ .../7.0/diagnostics-config-section.md | 66 +++++++++++++++++++ docs/core/compatibility/toc.yml | 10 +++ 3 files changed, 82 insertions(+) create mode 100644 docs/core/compatibility/configuration/7.0/diagnostics-config-section.md diff --git a/docs/core/compatibility/7.0.md b/docs/core/compatibility/7.0.md index ed196e8a95dfd..fd347921f67ef 100644 --- a/docs/core/compatibility/7.0.md +++ b/docs/core/compatibility/7.0.md @@ -51,6 +51,12 @@ If you're migrating an app to .NET 7, the breaking changes listed here might aff | [Tracking linked cache entries](core-libraries/7.0/memorycache-tracking.md) | ❌ | ✔️ | Preview 1 | | [Validate CompressionLevel for BrotliStream](core-libraries/7.0/compressionlevel-validation.md) | ❌ | ✔️ | Preview 1 | +## Configuration + +| Title | Binary compatible | Source compatible | Introduced | +| - | :-: | :-: | - | +| [System.diagnostics entry in app.config](configuration/7.0/diagnostics-config-section.md) | ❌ | ✔️ | RC 1 | + ## Cryptography | Title | Binary compatible | Source compatible | Introduced | diff --git a/docs/core/compatibility/configuration/7.0/diagnostics-config-section.md b/docs/core/compatibility/configuration/7.0/diagnostics-config-section.md new file mode 100644 index 0000000000000..0893e030d6db4 --- /dev/null +++ b/docs/core/compatibility/configuration/7.0/diagnostics-config-section.md @@ -0,0 +1,66 @@ +--- +title: "Breaking change: System.diagnostics entry in app.config" +description: Learn about the .NET 7 breaking change in configuration where the `
` entry is no longer allowed in an app.config file. +ms.date: 11/03/2022 +--- +# System.diagnostics entry in app.config + +For applications that have an *app.config* file, the `` entry may contain a `
` entry, which is no longer allowed. If present, you must remove the entry. + +Having a `
` entry causes the following run-time exception the first time the configuration system is used: + +> **ConfigurationErrorsException: Section or group name 'system.diagnostics' is already defined. Updates to this may only occur at the configuration level where it is defined.** + +For example, the following *app.config* file contains the unnecessary entry: + +```xml + + +
+ +``` + +This break will likely only occur for apps that: + +- Were migrated from .NET Framework to .NET. +- Had explicitly added `
` to the *app.config* file to support manual reading of the `` section. +- Were upgraded to .NET 7, which has an implicit `
` entry. + +## Previous behavior + +Specifying `
` was allowed and necessary if there was a later `` configuration section like the following: + +```xml + + +``` + +However, the section wasn't automatically read. That's because did not yet support the feature to add listeners and configure other diagnostic features by processing that section. + +.NET Framework, however, does support processing of a `` section and has a `
` entry in the *machine.config* file. + +## New behavior + + now supports reading the `` section from the config file and adds an implicit `
` entry. Having an explicit `
` entry in the *app.config* file causes a duplicate entry, which throws . + +## Version introduced + +.NET 7 RC 1 + +## Type of breaking change + +This change can affect [binary compatibility](../../categories.md#binary-compatibility). + +## Reason for change + +To support a new feature where reads from the *app.config* file, we had to add the implicit `
` element. + +## Recommended action + +Remove the unnecessary `
` section. + +## Affected APIs + +N/A diff --git a/docs/core/compatibility/toc.yml b/docs/core/compatibility/toc.yml index fb137b98744e3..d5613f37636a4 100644 --- a/docs/core/compatibility/toc.yml +++ b/docs/core/compatibility/toc.yml @@ -81,6 +81,10 @@ items: href: core-libraries/7.0/memorycache-tracking.md - name: Validate CompressionLevel for BrotliStream href: core-libraries/7.0/compressionlevel-validation.md + - name: Configuration + items: + - name: System.diagnostics entry in app.config + href: configuration/7.0/diagnostics-config-section.md - name: Cryptography items: - name: Dynamic X509ChainPolicy verification time @@ -825,6 +829,12 @@ items: href: code-analysis/5.0/ca2200-rethrow-to-preserve-stack-details.md - name: CA2247 warning href: code-analysis/5.0/ca2247-ctor-arg-should-be-taskcreationoptions.md + - name: Configuration + items: + - name: .NET 7 + items: + - name: System.diagnostics entry in app.config + href: configuration/7.0/diagnostics-config-section.md - name: Containers items: - name: .NET 6 From fa3f684c5da32f4c0f3bcf5b36e162012165b967 Mon Sep 17 00:00:00 2001 From: Genevieve Warren <24882762+gewarren@users.noreply.github.com> Date: Thu, 3 Nov 2022 12:18:55 -0700 Subject: [PATCH 2/3] tweak --- .../configuration/7.0/diagnostics-config-section.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/core/compatibility/configuration/7.0/diagnostics-config-section.md b/docs/core/compatibility/configuration/7.0/diagnostics-config-section.md index 0893e030d6db4..cb2f367c10f8e 100644 --- a/docs/core/compatibility/configuration/7.0/diagnostics-config-section.md +++ b/docs/core/compatibility/configuration/7.0/diagnostics-config-section.md @@ -55,7 +55,7 @@ This change can affect [binary compatibility](../../categories.md#binary-compati ## Reason for change -To support a new feature where reads from the *app.config* file, we had to add the implicit `
` element. +To support a new feature where reads from the *app.config* file, we had to add the implicit `
` element. ## Recommended action From ccfcbd87addb1fadf9209acb5655e6a610455d0f Mon Sep 17 00:00:00 2001 From: Genevieve Warren <24882762+gewarren@users.noreply.github.com> Date: Fri, 4 Nov 2022 09:45:18 -0700 Subject: [PATCH 3/3] respond to feedback --- .../configuration/7.0/diagnostics-config-section.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/core/compatibility/configuration/7.0/diagnostics-config-section.md b/docs/core/compatibility/configuration/7.0/diagnostics-config-section.md index cb2f367c10f8e..7ceb90015a75f 100644 --- a/docs/core/compatibility/configuration/7.0/diagnostics-config-section.md +++ b/docs/core/compatibility/configuration/7.0/diagnostics-config-section.md @@ -5,9 +5,9 @@ ms.date: 11/03/2022 --- # System.diagnostics entry in app.config -For applications that have an *app.config* file, the `` entry may contain a `
` entry, which is no longer allowed. If present, you must remove the entry. +For applications that have an *app.config* file, the `` entry is no longer allowed to contain a `
` entry. If present, you must remove the entry. -Having a `
` entry causes the following run-time exception the first time the configuration system is used: +Having a `
` entry throws the following run-time exception when the configuration system is first used: > **ConfigurationErrorsException: Section or group name 'system.diagnostics' is already defined. Updates to this may only occur at the configuration level where it is defined.**