Joslian / protobuf-net

Automatically exported from code.google.com/p/protobuf-net
Other
0 stars 0 forks source link

Deserializing Dictionary<string, List<T>> leads to An element with the same key already exists in the dictionary. #454

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
Please include an e-mail address if this might need a dialogue!
==============
email: youri@tu-sofia.bg
What steps will reproduce the problem?
1. Create a serializable Dictionary<string, List<MyClassType>>
2. Serialize it
3. Deserialize it.

What is the expected output? What do you see instead?
Expected output is Serializer.Deserialzie to fill in the saved dictionary into 
a null Dictionary of the same type. (I'm using a class as a wraper)

What version of the product are you using? On what operating system?
win 8.1.
version rotobuf-net r668 

Please provide any additional information below.
The whole error message
ArgumentException: An element with the same key already exists in the 
dictionary.
System.Collections.Generic.Dictionary`2[System.String,System.Collections.Generic
.List`1[SerializationLib.UpgradeData]].Add (System.String key, 
System.Collections.Generic.List`1 value) (at 
/Users/builduser/buildslave/mono-runtime-and-classlibs/build/mcs/class/corlib/Sy
stem.Collections.Generic/Dictionary.cs:404)
System.Collections.Generic.Dictionary`2[System.String,System.Collections.Generic
.List`1[SerializationLib.UpgradeData]].System.Collections.Generic.ICollection<Sy
stem.Collections.Generic.KeyValuePair<TKey,TValue>>.Add (KeyValuePair`2 
keyValuePair) (at 
/Users/builduser/buildslave/mono-runtime-and-classlibs/build/mcs/class/corlib/Sy
stem.Collections.Generic/Dictionary.cs:705)
DataSerializer.Read (SerializationLib.CharacterUpgradeList , 
ProtoBuf.ProtoReader )
DataSerializer.Deserialize (Int32 , System.Object , ProtoBuf.ProtoReader )
ProtoBuf.Meta.TypeModel.DeserializeCore (ProtoBuf.ProtoReader reader, 
System.Type type, System.Object value, Boolean noAutoCreate)
ProtoBuf.Meta.TypeModel.Deserialize (System.IO.Stream source, System.Object 
value, System.Type type, ProtoBuf.SerializationContext context)
ProtoBuf.Meta.TypeModel.Deserialize (System.IO.Stream source, System.Object 
value, System.Type type)
ProtoWraper.LoadObjectFromPath[CharacterUpgradeList] (System.String path) (at 
Assets/Scripts/ProtoWraper.cs:33)
DataHolder.OnEnable () (at Assets/Scripts/DataHolder.cs:64)

Original issue reported on code.google.com by FusioNKu...@gmail.com on 12 Mar 2015 at 11:16