我已经能够毫无问题地序列化可空双精度数,并且可以序列化可空其他类型的列表,但不能序列化可空双精度数列表。
如果我这样做:
List<double?> aList = new List<double?>();
aList.Add(0.1);
aList.Add(null);
Serializer.Serialize(ms, aList);
我收到此错误:
System.NullReferenceException:对象引用未设置为对象的实例。在 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:ProtoBuf.Meta.TypeModel.Serialize 的第 188 行(Stream dest,Object 值, SerializationContext context) 在 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:第 201 行,位于 c:\Dev\protobuf-net\protobuf-net\Serializer 中的 ProtoBuf.Serializer.Serialize[T](流目标,T 实例)。
这应该工作吗?难道我做错了什么?