DerrickBrayanClayton / protobuf-net

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

IDictionary<T1,IDictionary<T2,T3>> and MissingMethodException #84

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1.  Create a class with a property of type
IDictionary<string,IDictionary<string,string>> and decorate with attributes
appropriately.
2.  Serialize
3.  Deserialize

What is the expected output? What do you see instead?

I should see the the IDictionary I serialized.  Instead I get a
MissingMethodException (Message = "Cannot Create an Instance of an Interface")

What version of the product are you using? On what operating system?
r274

Please provide any additional information below.

The DataContractSerializer doesn't fall over on my test case.  If you need
any more info you can reach me at jason dot punyon at gmail dot com.

Thanks Man.

Original issue reported on code.google.com by Jason.Pu...@gmail.com on 24 Nov 2009 at 7:25

Attachments:

GoogleCodeExporter commented 8 years ago
Also...I'm on XP SP3

Original comment by Jason.Pu...@gmail.com on 24 Nov 2009 at 7:55

GoogleCodeExporter commented 8 years ago
Will investigate; I know that IList<T> has a default implementation of List<T>, 
but 
there I can't remember having a default for IDictionary<TKey,TValue> - 
presumably 
Dictionary<TKey,TValue> would suffice. I'd also need to double-check the 
behaviour of 
nested dictionaries...

Original comment by marc.gravell on 24 Nov 2009 at 8:18

GoogleCodeExporter commented 8 years ago
The concrete version works; Dictionary<string, Dictionary<string, string>> - 
I'll see 
what can be done about the interface version, but it is actually hiding under 
`IEnumerable<T>+Add(T)` at the moment, so not quite as simple to hack in as 
IList<T>.

Original comment by marc.gravell on 24 Nov 2009 at 8:22

GoogleCodeExporter commented 8 years ago
I should've mentioned this but I also did a test of a non-nested IDictionary 
which
didn't fall over...sounds like that would point to the nesting.

Original comment by Jason.Pu...@gmail.com on 24 Nov 2009 at 8:23

GoogleCodeExporter commented 8 years ago
Hmm... yes, I can reproduce that; very odd. Will look, but I'm in the middle of 
a book 
review at the moment - do you need this urgently?

Original comment by marc.gravell on 24 Nov 2009 at 8:45

GoogleCodeExporter commented 8 years ago
Definitely don't interrupt your work for this.  I'm no one of any consequence :)

Although now I have to wonder had I replied "YES URGenT PLZSENDTEHCODEZ!!1!!", 
would
you have really done it? :)

Original comment by Jason.Pu...@gmail.com on 24 Nov 2009 at 8:59

GoogleCodeExporter commented 8 years ago
I might have done ;-p I had a few days spare on the book work, so I could have 
taken a 
peek. But I didn't, and the book work is now "in" (for now at least). I'm 
planning on 
taking a peek at this on the train...

Original comment by marc.gravell on 25 Nov 2009 at 3:59

GoogleCodeExporter commented 8 years ago
The good news is that I've got it working (and removed some ugly code in the 
process); 
just regression testing / optimising etc.

Original comment by marc.gravell on 25 Nov 2009 at 9:31

GoogleCodeExporter commented 8 years ago
r278

Original comment by marc.gravell on 25 Nov 2009 at 10:50

GoogleCodeExporter commented 8 years ago
In two words...Absolutely Wonderful.  Thanks a bunch.  I'll tweet you when I 
write up
your kudos.

Original comment by Jason.Pu...@gmail.com on 30 Nov 2009 at 9:29

GoogleCodeExporter commented 8 years ago
You're welcome. Marking as verified.

Original comment by marc.gravell on 30 Nov 2009 at 9:31