diff --git a/docs/core/compatibility/7.0.md b/docs/core/compatibility/7.0.md index e9cd4ae896c18..bd9280109c6a0 100644 --- a/docs/core/compatibility/7.0.md +++ b/docs/core/compatibility/7.0.md @@ -53,6 +53,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..7ceb90015a75f --- /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 is no longer allowed to contain a `
` entry. If present, you must remove the entry. + +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.** + +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 2c6a965f786ca..488d71c84e05d 100644 --- a/docs/core/compatibility/toc.yml +++ b/docs/core/compatibility/toc.yml @@ -85,6 +85,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 @@ -829,6 +833,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