Skip to content
This repository was archived by the owner on Dec 18, 2018. It is now read-only.
This repository was archived by the owner on Dec 18, 2018. It is now read-only.

Config sources convert dots to colons in config keys #106

Closed
@Eilon

Description

@Eilon

Not sure why we do this kind of normalization. It took quite a while to debug this when porting a customer application from MVC 5 using web.config to using MVC 6 with config.json.

Repro:

Have this config.json file:

{
    "foo.bar":  "foo.bar value"
}

And this MVC controller:

public IActionResult Index()
{
    var config = new Configuration().AddJsonFile("config.json");
    var configData = new StringBuilder();
    foreach (var key in new[] { "foo.bar", "foo:bar" })
    {
        configData.AppendFormat("[{0}] = {1}<br/>", key, config[key]);
    }
    return Content(configData.ToString());
}

And run it.

Note that the foo.bar key has no value, whereas the foo:bar key does (even though that's nowhere in my config file). Very confusing.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions