AqlaSolutions / AqlaSerializer

Binary serializer with full .NET support!
http://www.aqla.net
Other
16 stars 3 forks source link

Invalid serialization operation with wire-type None #35

Closed inethui closed 2 years ago

inethui commented 2 years ago

The following test throws AqlaSerializer.ProtoException : AqlaSerializer.ProtoException : Invalid serialization operation with wire-type None, waiting for wire type of field number 2, position 5

Any idea why? Thanks

        [Fact]
        public void TestNamedTuples()
        {
            (int Number1, int? Number2) obj = (1, null);

            var clone = Serializer.DeepClone(obj);

            Assert.Equal(clone.Number1, obj.Number1);
            Assert.Equal(clone.Number2, obj.Number2);
        }
inethui commented 2 years ago

If I change the test to the followings, I get another error from the DeepClone method: System.InvalidProgramException : Common Language Runtime detected an invalid program.

        [Fact]
        public void TestNamedTuples()
        {
            (int Number1, int? Number2) obj = (1, 2);

            var clone = Serializer.DeepClone(obj);

            Assert.Equal(clone.Number1, obj.Number1);
            Assert.Equal(clone.Number2, obj.Number2);
        }
inethui commented 2 years ago

BTW, the above code works for Protobuf-net.

AqlaSolutions commented 2 years ago

Probably value tuples are not supported yet. It's the next thing to fix.

AqlaSolutions commented 2 years ago

This is fixed in develop branch, please check.

inethui commented 2 years ago

I've verified that this issue is fixed in develop branch.