Skip to content
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

Add support for repeated XML elements without a name attribute #43722

Closed
wants to merge 6 commits into from

Commits on Oct 22, 2020

  1. Add support for repeated XML elements without a name attribute

    This commit adds support in Microsoft.Extensions.Configuration.Xml for repeated XML elements without requiring a Name attribute.
    This solves a particularly subtle bug when configuring Serilog from an XML configuration source. For a full description, see dotnet#36541
    
    The original implementation of the XmlStreamConfigurationProvider has been modified to do the following:
    
    - Maintain a stack of encountered XML elements while traversing the XML source. This is needed to detect siblings.
    - When siblings are detected, automatically append an index to the generated configuration keys. This makes it work exactly the same as the JSON configuration provider with JSON arrays.
    
    Tests are updated to reflect the new behavior:
    - Tests that verified an exception occurs when entering duplicate keys have been removed. Duplicate keys are supported now.
    - Add tests that verify duplicate keys result in the correct configuration keys, with all the lower/upper case variants and with support for the special "Name" attribute handling.
    amoerie committed Oct 22, 2020
    Configuration menu
    Copy the full SHA
    0e64437 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    8cf97e9 View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    4133ca0 View commit details
    Browse the repository at this point in the history
  4. Configuration menu
    Copy the full SHA
    445ca13 View commit details
    Browse the repository at this point in the history

Commits on Oct 24, 2020

  1. Configuration menu
    Copy the full SHA
    93d817e View commit details
    Browse the repository at this point in the history
  2. Run duplicate test config through the XML provider

    This ensures that, at the very least, it doesn't crash
    Correct behavior is covered by other tests
    amoerie committed Oct 24, 2020
    Configuration menu
    Copy the full SHA
    88e4f54 View commit details
    Browse the repository at this point in the history