A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://github.com/msgpack/msgpack-cli/issues/199 below:

Index out of bounds exception when trying to deserialize object with missing List property on iPad · Issue #199 · msgpack/msgpack-cli · GitHub

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


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4