Skip to content

JsonUnmappedMemberHandling.Disallow has no effect when using JsonFSharpConverter #208

@cmeeren

Description

@cmeeren

Repro:

let options = JsonSerializerOptions(UnmappedMemberHandling = JsonUnmappedMemberHandling.Disallow)
options.Converters.Add(JsonFSharpConverter())

type A = { X: int }

JsonSerializer.Deserialize<A>("""{"X":1,"Y":2}""", options)

Expected: The last line should throw System.Text.Json.JsonException: The JSON property 'Y' could not be mapped to any .NET member contained in type 'A'.

Actual: Deserializes without throwing.

Removing options.Converters.Add(JsonFSharpConverter()) produces the expected result (throws).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions