Skip to content

ConfigurationSection.SerializeSection() does not populate collections  #43964

Open
@thedigitaljedi86

Description

@thedigitaljedi86

Description

When trying to use SerializeSection on a custom configuration section all collections are returned with exactly 1 empty node of the respective object type.

A symptom seems to be that an exception is thrown saying "The key '' has already been added".

To reproduce create a .net core 3.1 or above. Include the System.Configuration.ConfigurationManager nuget package and create a custom configuration section, then try to call SerializeSection with ConfigurationSaveMode.Full.

Configuration

Which version of .NET is the code running on: .net core 3.1 and 5.0 preview 7
What OS and version, and what distro if applicable: Windows 10 latest update
What is the architecture (x64, x86, ARM, ARM64): X64
Do you know whether it is specific to that configuration: It is unreleated to Windows and the architecture.

Regression?

The exact same code and custom configration section works on .Net Framework 4.7.2 and 4.8

Other information

I have tried to override the BaseAdd method to make sure that was called - and it was. For all nodes inside a collection as well

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions