Skip to content

Using config with fallback as fallback for another config looses fallback values #196

Closed
@IgorFedchenko

Description

@IgorFedchenko

The following fails:

var config = ConfigurationFactory.ParseString("a = 1");
var fallback = ConfigurationFactory.ParseString("b = 2");
var configWithFallback = config.WithFallback(fallback);

var anotherConfig = ConfigurationFactory.ParseString("c = 1");
var merged = anotherConfig.WithFallback(configWithFallback);
// Here we loose value that was fallback for configWithFallback
merged.GetInt("b").Should().Be(2);

When getting values from fallback config, need to get their fallbacks as well. Most likely this can be resolved with simple using Fallback.Root instead of Fallback.Value when building final config.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions