AqlaSolutions / AqlaSerializer

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

Cannot serialize null string when serializing with length prefix #10

Closed aienabled closed 8 years ago

aienabled commented 8 years ago

Hello! When I'm using public void SerializeWithLengthPrefix(Stream dest, object value, Type type, PrefixStyle style, int fieldNumber, SerializationContext context). for serializing null string with PrefixStyle.Base128 I've got this exception: System.NullReferenceException: Object reference not set to an instance of an object. at AqlaSerializer.ProtoWriter.WriteObject(Object value, Int32 key, ProtoWriter writer, PrefixStyle style, Int32 fieldNumber, Boolean isRoot) in C:\Projects\Games\LibsSources\Aqla\Serializer\AqlaSerializer\protobuf-net\ProtoWriter.cs:line 160

Is that by-design or a bug?

Regards!

aienabled commented 8 years ago

It seems the question could be extending to serializing any nullable root objects.

AqlaSolutions commented 8 years ago

@aienabled serializing nullable root is not supported by design. You can wrap your nullable objects into a generic container.

aienabled commented 8 years ago

@AqlaSolutions, ok, so I will need to wrap these objects into some generic container. No problem, thanks!