Skip to content

IConfiguration with empty array elements #58930

@ptjuanramos

Description

@ptjuanramos

Description

By having a JSON element in appSettings, disregarding the environment. It seems that the binder can't map the "ContentSecurityPolicy" children elements:

"ContentSecurityPolicy": {
    "DefaultSrc": [],
    "ScriptSrc": [],
    "FrameAncestors": [],
    "PluginTypes": [],
    "ReportTo": [],
    "NavigateTo": []
  }

E.g:

IConfiguration configuration = ... ;
IConfigurationSection cspSection = _configuration?.GetSection("ContentSecurityPolicy");
Assert.IsFalse(cspSection.GetChildren().Any()); //passed

Other information

Is this somehow related with this closed issue?

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions