leejw51 / protobuf-net

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

MetaType.ConstructType is ignored for collections/list types #237

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
Please include an e-mail address if this might need a dialogue!
==============

What steps will reproduce the problem?
1. Run the attached example
2. The Deserialize Call throws an Exception("Value cannot be null.")

What is the expected output? What do you see instead?
I assign a constructType to the Interface used in my data objects, it should be 
used to create the Set:
RuntimeTypeModel.Default[typeof(ISet<>)].ConstructType = typeof(HashSet<>);

What version of the product are you using? On what operating system?
Latest svn, r444

Please provide any additional information below.

I have attached a patch that fixes the issue for me, basically i've changed the 
MetaType.ResolveListTypes to search the model for a list type, and if one is 
found to check and use the construct type.

Original issue reported on code.google.com by ANeumann...@googlemail.com on 2 Oct 2011 at 2:01

Attachments:

GoogleCodeExporter commented 9 years ago
The provided example is for .net 4, but the same issue arises for example if 
you're using the Iesi.Collections.Generic.ISet and 
Iesi.Collections.Generic.HashedSet from the NHibernate-Project.

Original comment by ANeumann...@googlemail.com on 2 Oct 2011 at 2:04