I've been able to serialize nullable doubles without an issue, and can serialize Lists of nullable other types, but can't serialize Lists of nullable doubles.
If I do this:
List<double?> aList = new List<double?>();
aList.Add(0.1);
aList.Add(null);
Serializer.Serialize(ms, aList);
I get this error:
System.NullReferenceException: Object reference not set to an instance of an object. at ProtoBuf.Meta.TypeModel.TrySerializeAuxiliaryType(ProtoWriter writer, Type type, DataFormat format, Int32 tag, Object value, Boolean isInsideList) in c:\Dev\protobuf-net\protobuf-net\Meta\TypeModel.cs:line 169 at ProtoBuf.Meta.TypeModel.SerializeCore(ProtoWriter writer, Object value) in c:\Dev\protobuf-net\protobuf-net\Meta\TypeModel.cs:line 188 at ProtoBuf.Meta.TypeModel.Serialize(Stream dest, Object value, SerializationContext context) in c:\Dev\protobuf-net\protobuf-net\Meta\TypeModel.cs:line 217 at ProtoBuf.Meta.TypeModel.Serialize(Stream dest, Object value) in c:\Dev\protobuf-net\protobuf-net\Meta\TypeModel.cs:line 201 at ProtoBuf.Serializer.Serialize[T](Stream destination, T instance) in c:\Dev\protobuf-net\protobuf-net\Serializer.cs:line 87
should this work? Am I doing something wrong?
List<int?>
, aList<double?>
and aList<string>
- they all behaved identically here – Marc Gravell♦