Skip to content

bug(ConfigurationBuilder): Empty value in json read wrong use ConfigurationBuilder on NET10 #121436

@ArgoZhang

Description

@ArgoZhang

Description

Json config

"TestSection": {
  "Test-Null": null,
  "Test-Key:": ""
}

Code

builder.AddJsonFile(jsonPath, true, false);

var config = builder.Build();

var children = config.GetSection("TestSection").GetChildren();

foreach (var child in children)
{
    Console.WriteLine($"{child.Key}: {child.Value}");
}

Result

In NET9.0 (Correct)

section TestSection Test-Key value is string.Empty

In NET10 (Incorrent)

section TestSection Test-Key value is NULL

Reproduction Steps

repro project
ConsoleApp1.zip

Expected behavior

In NET9.0

section TestSection Test-Key value is string.Empty

In NET10

section TestSection Test-Key value is string.Empty

Actual behavior

In NET9.0

section TestSection Test-Key value is string.Empty

In NET10

section TestSection Test-Key value is NULL

Regression?

No response

Known Workarounds

No response

Configuration

No response

Other information

No response

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions