Skip to content

MessagePackSerializationException: Not supported primitive object resolver. type: MyComponent #104

@Shelim

Description

@Shelim

Description

Arch.Persistence is broken under MessagePack 3.x - throws exception on serialize, see data below.
I cannot fallback do MessagePack 2.x due to AOT requirements (IL2CPP platform).

The exception is thrown due to attempt to serialize boxed struct as non-generic object. This is not support under MessagePack 3.x

MRE:

New console app, install:

  • MessagePack 3.1.4
  • Arch 2.0.0
  • Arch.Persistence 2.0

Run under IL2CPP platform

public struct MyComponent
{
    public ushort Data;

    public MyComponent(ushort data)
    {
        Data = data;
    }
}
public class Test
{
    static Test()
    {
        ComponentRegistry.Add<MyComponent>();
    }
    static void Main(string[] args)
    {
        var ecs = World.Create();
        var entity = ecs.Create(new MyComponent(1));
        var serializer = new ArchBinarySerializer();
        ecs = serializer.Deserialize(serializer.Serialize(ecs));
    }
}

Expected result

Correct execution of the program, exceptionless

Actual result

MessagePackSerializationException: Not supported primitive object resolver. type:MyComponent
  at MessagePack.Formatters.PrimitiveObjectFormatter.Serialize (MessagePack.MessagePackWriter& writer, System.Object value, MessagePack.MessagePackSerializerOptions options)

Thrown at Arch.Persistence/Binary.cs:118

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