JsonSerializer should round trip AuthenticationProperties (original) (raw)

JsonSerializer doesn't seem to seralize/deseralize the AuthenticationProperties class properly.

This test:

[Fact]
public void JsonSerializer_should_round_trip_AuthenticationProperties()
{
    var props = new AuthenticationProperties();
    props.Items.Add("foo", "bar");
            
    var json = JsonSerializer.Serialize(props);
    props = JsonSerializer.Deserialize<AuthenticationProperties>(json);

    props.Items.ContainsKey("foo").Should().BeTrue();
    props.Items["foo"].Should().Be("bar");
}

Fails with:

Message: 
    Expected props.Items.ContainsKey("foo") to be true, but found False.

Using ASP.NET Core 3.1.3.

Please advise.