Skip to content

[System.Text.Json] Deserializing null array throws null-ref #29520

@gnovack

Description

@gnovack

Passing "null" to JsonSerializer.Parse when deserializing arrays throws NullReferenceException.

int[] obj = JsonSerializer.Parse<int[]>("null");

//throws:
//Object reference not set to an instance of an object.
//at System.Text.Json.Serialization.JsonSerializer.ApplyObjectToEnumerable(Object value, JsonSerializerOptions options, ReadStack& state, Utf8JsonReader& reader, Boolean setPropertyDirectly)

Metadata

Metadata

Assignees

No one assigned

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions