A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://github.com/protobuf-net/protobuf-net/issues/341 below:

Serializing nullable type in dictionary · Issue #341 · protobuf-net/protobuf-net · GitHub

I upgraded to version 2.3.3 from 2.0.0.668 and I now get an error when serializing a class that contains a dictionary with a nullable type.

[ProtoMember(17)]
public Dictionary<String, bool?> Mapping { get; set; }

ProtoBuf.ProtoException
HResult=0x80131500
Message=Data of this type has inbuilt behaviour, and cannot be added to a model in this way: System.Nullable`1[[System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]] (Griffeye.Domain.EntityCriteria.DigestSourceImportCriteria)
Source=protobuf-net
StackTrace:
at ProtoBuf.Meta.RuntimeTypeModel.GetKey(Type type, Boolean demand, Boolean getBaseKey) in C:\code\protobuf-net\src\protobuf-net\Meta\RuntimeTypeModel.cs:line 794
at ProtoBuf.Meta.TypeModel.GetKey(Type& type) in C:\code\protobuf-net\src\protobuf-net\Meta\TypeModel.cs:line 1281
at ProtoBuf.Meta.TypeModel.SerializeCore(ProtoWriter writer, Object value) in C:\code\protobuf-net\src\protobuf-net\Meta\TypeModel.cs:line 192
at ProtoBuf.Meta.TypeModel.Serialize(Stream dest, Object value, SerializationContext context) in C:\code\protobuf-net\src\protobuf-net\Meta\TypeModel.cs:line 228
at ProtoBuf.Serializer.Serialize[T](Stream destination, T instance) in C:\code\protobuf-net\src\protobuf-net\Serializer.cs:line 106

I have tried adding ProtoMap(DisableMap = true) but that did not help either.

Is there anything I need to do in the new version to get this to work?


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4