Skip to content

Mixed appsettings.json & appsettings.development.json #3735

@karelz

Description

@karelz

From @johndhunter on October 27, 2018 13:10

I seem to be getting results from both appsettings.json and appsettings.development.json when I use the following:
var users = _configuration.GetSection("AdministrationUsers");

my appsettings.development.json is like:

"AdministrationUsers": [
    {
      "Email": "[email protected]",
      "PasswordHash": "AQAAAAEAACcQAAAAEJqwmeQsHrAZySU8kIV8BJPsEGirVXddDhU0EWabuGdGzNj93/9MXQ17hsFhRENbqA=="
    }
  ]

whilst my appsettings.json is like:

"AdministrationUsers": [
    {
      "Email": "[email protected]",
      "PasswordHash": "AQAAAAEAACcQAAAAEJqwmeQsHrAZySU8kIV8BJPsEGirVXddDhU0EWabuGdGzNj93/9MXQ17hsFhRENbqA=="
    },
    {
      "Email": "[email protected]",
      "PasswordHash": "AQAAAAEAACcQAAAAEJqwmeQsHrAZySU8kIV8BJPsEGirVXddDhU0EWabuGdGzNj93/9MXQ17hsFhRENbqA=="
    }
  ]

With ASPNETCORE_ENVIRONMENT set to Development and using the default CreatedDefaultBuilder and no other settings - I see the Email for [email protected] AND the Email for [email protected] - suggesting the list that is built up seems to be shared. I.e. I would expect the results (i.e. the entire collection) to have come from only one of the files - but maybe that is how it's supposed to work - if so, perhaps the configuration docs need an update pertaining to collections.

Copied from original issue: dotnet/corefx#33091

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