-
Notifications
You must be signed in to change notification settings - Fork 6k
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
[Breaking change]: app.config cannot have a <section name="system.diagnostics"
entry
#32147
Comments
Is |
No, the exception occurs the first time the configuration system is used. So, for example, just this will cause the exception:
|
Note that I need to update the description here to remove the .NET Framework references since that was not correct -- .NET Framework had a machine.config file with the diagnostics section and did not force the entry in the app.config. |
(description updated; ready for review) |
Description
For applications that have an app.config, the
<configuration><configSection>
entry may contain a<section name="system.diagnostics"
entry which is no longer allowed. If present, the entry needs to be removed.Having a
<section name="system.diagnostics"
entry causes the following 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, this app.config file:
contains the unnecessary entry.
Feature area: System.Configuration (app.config files)
Version
.NET 7 RC 1
Previous behavior
Specifying
<section name="system.diagnostics"
was allowed and necessary if there was a latersystem.diagnostics
configuration section like:However, System.Diagnostics did not yet support the feature that processes that section in order to add various listeners and other control other diagnostic features, so it was not automatically read. Only applications which had a
<system.diagnostics>
section would require a<section name="system.diagnostics"
entry..NET Framework, however, does support processing of the "system.diagnostics" section and had an
<section name="system.diagnostics"
in the machine.config file.Thus, this issue likely only occurs for:
<section name="system.diagnostics"
to the app.config to support manual reading of the<system.diagnostics>
section.<section name="system.diagnostics"
entry.New behavior
System.Diagnostics now supports reading the
<system.diagnostics>
section from the config file and added an implicit<section name="system.diagnostics"
entry. Having an explicit<section name="system.diagnostics"
entry in the app.config file causes a duplicate which throwsConfigurationErrorsException
.Type of breaking change
Reason for change
The implementation to support the feature where System.Diagnostics reads from the app.config required adding the implicit
<section name="system.diagnostics"
element. See dotnet/runtime#23937 for details on the feature request.Recommended action
The unnecessary
<section name="system.diagnostics"
entry should be removed.Feature area
Other (please put exact area in description textbox)
Affected APIs
No response
The text was updated successfully, but these errors were encountered: