Closed MagicAndre1981 closed 1 year ago
Tagging subscribers to this area: @dotnet/area-system-configuration See info in area-owners.md if you want to be subscribed.
Author: | MagicAndre1981 |
---|---|
Assignees: | - |
Labels: | `area-System.Configuration`, `untriaged` |
Milestone: | - |
ok, it looks like the Firebird provider no longer used the config so I can remove it to workaround the issue. I'll leave it open for further investigations.
I'll leave it open for further investigations.
@MagicAndre1981 could you provide a sample app for repro? Tried to follow the Reproduction Steps
provided, but it did not work, I guess the steps are not complete and as I am not that familiar with WinForms and related settings could not fill in the missing part
This issue has been marked needs-author-action
and may be missing some important information.
I'll leave it open for further investigations.
@MagicAndre1981 could you provide a sample app for repro?
here it is:
https://github.com/MagicAndre1981/WinFormsDemoAppRuntimeIssue77369
I added net6 and .net7 as TargetFrameworks and the 6.0 version runs fine, while the 7.0 fails.
I checked the breaking changes, but haven't found anything related to System.Configuration
so it looks like a bug to me or if this an intended change, document it please.
Thanks @MagicAndre1981 for the repro, it looks we added the system.diagnostics
in the implicit machine config list:
https://github.com/dotnet/runtime/blob/40df8f6a4c1a1b0b1b731f2a8023b5bb10357790/src/libraries/System.Configuration.ConfigurationManager/src/System/Configuration/ImplicitMachineConfigHost.cs#L84
so you should not add it in App.config manually, the fix is obviously removing that <section name="system.diagnostics ..."
section from the <configSections>
.
I checked the breaking changes, but haven't found anything related to System.Configuration so it looks like a bug to me or if this an intended change, document it please.
Right, it does look like breaking change and needs documented CC @steveharter
it looks we added the
system.diagnostics
in the implicit machine config list:so you should not add it in App.config manually, the fix is obviously removing that
<section name="system.diagnostics ..."
section from the<configSections>
.Right, it does look like breaking change and needs documented CC @steveharter
ok, thanks, please document this when 7.0 gets GA to avoid further confusions
The 7.0 PR https://github.com/dotnet/runtime/pull/73087 added support to automatically read the config file for the System.Diagnostics section -- previously the config section wasn't read and basically was ignored. So those moving from .NET Framework that had an existing app.config file with the diagnostic section would have found that the section was ignored and the various tracesource, switches etc were not hooked up (until the 7.0 PR above).
it looks https://github.com/dotnet/runtime/pull/73087 the system.diagnostics in the implicit machine config list:
Yes thanks that is the issue -- the entry in the app.config is no longer necessary and causes the exception.
Right, it does look like breaking change and needs documented CC @steveharter
Per offline discussion, it seems like this is more of a porting issue that should be documented in https://learn.microsoft.com/en-us/dotnet/architecture/modernize-desktop/migrate-modern-applications#migrating-configuration-files . In general, all of the implicit sections (8 or so) no longer can be in the app.config.
I did create the breaking change issue: https://github.com/dotnet/docs/issues/32147
We should create a docs issue to update https://learn.microsoft.com/en-us/dotnet/architecture/modernize-desktop/migrate-modern-applications#migrating-configuration-files.
Doc issue created: https://github.com/dotnet/docs/issues/32169
Description
I try to migrate a WinForms application from .net6 to .net 7 and noticed that I get an System.Configuration.ConfigurationErrorsException saying that Section or group name 'system.diagnostics' is already defined:
Reproduction Steps
if (Settings.Default.myBoolSetting)
) and exception occrursExpected behavior
app runs fine
Actual behavior
exception
Regression?
yes, worked in .net 6
Known Workarounds
nothing found
Configuration
.net 7.0 RC2, Windows 11 22621
Other information
No response