AqlaSolutions / AqlaSerializer

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

Un-defined enum values #42

Closed inethui closed 2 years ago

inethui commented 2 years ago

Protobuf-net allows un-defined enum values, but Aqla doesn't. The following code shows that:

        private enum Number { One, Two, Three }

        [Fact]
        public void TestNotDefinedEnum()
        {
            Number four = (Number)4;

            var clone = ProtoBuf.Serializer.DeepClone(four);
            Assert.Equal(clone, four);

            var clone2 = AqlaSerializer.Serializer.DeepClone(four);
            Assert.Equal(clone2, four);
        }

Is there a way to support undefined enum values with Aqla?

AqlaSolutions commented 2 years ago

This behavior can be toggled with EnumPassthru on a type attribute or MetaType property. I have changed its defaults to true in develop branch.