Skip to content

Configuration binding of type Dictionary<string, object> fails if value is List #36505

@ti82

Description

@ti82

Using this POCO settings class:

public class RuntimeSettings
{
    public string Type { get; set; }
    public Dictionary<string, object> Parameters { get; set; }
}

Using object as the value type lets this be more generic and support strings, ints, bools, etc.

And a settings JSON file like this:

{
  "Type": "MyRuntimeType",
  "Parameters": {
    "param1": true,
    "param2": [ "Hello", "World" ]
  }
}

I get a ArgumentNullException when binding the configuration like this.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions