Skip to content

Index out of bounds exception when trying to deserialize object with missing List property on iPad #199

Description

@diopol

This simple scenario throws exception on iPad:

    public class Obj1
    {
        [MessagePackMember(0)]
        public string Id { get; set; }

        [MessagePackMember(1)]
        public List<string> Items { get; set; }
    }

    public class Obj2
    {
        [MessagePackMember(0)]
        public string Id { get; set; }

        // doesn't know about Items
    }

    void ThisMethodThrowsIndexOutOfBoundsException()
    {
        using (var memStream = new MemoryStream())
        {
            SerializationContext.Default.GetSerializer<Obj1>().Pack(memStream, new Obj1
            {
                Id = "1",
                Items = new List<string> { "a", "b" }
            });

            memStream.Seek(0, SeekOrigin.Begin);

            var serializer2 = SerializationContext.Default.GetSerializer<Obj2>();

            // this call throws
            Obj2 obj = serializer2.Unpack(memStream);
        }
    }

Works well in full .NET
MsgPack Cli is installed from Nuget, version 0.8.0

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugDetected as bug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions