Skip to content

System.Text.Json Serializer does not appear to work on Xamarin iOS #31326

@jefffhaynes

Description

@jefffhaynes

Perhaps not surprisingly, System.Text.Json.Serializer does not appear to function on iOS likely owing to the lack of Emit support.

public class ChatMessage
{
    [JsonPropertyName("id")]
    public string Id { get; set; }

    [JsonPropertyName("sent")]
    public DateTime? SentOn { get; set; }
}

JsonSerializer.Deserialize<ChatMessage>(json);

This yields:

System.ExecutionEngineException: Attempting to JIT compile method '(wrapper delegate-invoke) void :invoke_callvirt_void_ChatMessage_Nullable1<DateTime> (Chat.Messaging.ChatMessage,System.Nullable1<System.DateTime>)' while running in aot-only mode. See https://docs.microsoft.com/xamarin/ios/internals/limitations for more information.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions