Skip to content

Conversation

nicwise
Copy link
Contributor

@nicwise nicwise commented Jul 11, 2012

Bug records:

#293

https://bugzilla.xamarin.com/show_bug.cgi?id=6031

In MonoTouch, the changed line of code (without the change) causes an issue, as the list of interfaces CAN include non-generic types, and the ordering is not fixed, so you can get a non-generic type first. Calling GetGenericTypeDefinition on a non-generic crashes things.

If the code checks for it being generic first:

var listType = type.GetInterfaces().First(x => x.IsGenericType && x.GetGenericTypeDefinition() == typeof(IList<>));

then it doesn't fail.

@nicwise
Copy link
Contributor Author

nicwise commented Jul 11, 2012

Sorry, not well explained. In MonoTouch, the changed line of code (without the change) causes an issue, as the list of interfaces CAN include non-generic types, and the ordering is not fixed, so you can get a non-generic type first.

If the code checks for it being generic first:

var listType = type.GetInterfaces().First(x => x.IsGenericType && x.GetGenericTypeDefinition() == typeof(IList<>));

then it doesn't fail.

petejohanson added a commit that referenced this pull request Jul 11, 2012
MonoTouch: Issue 293: JsonDeserialzer crashes on generic lists
@petejohanson petejohanson merged commit 4059ae6 into restsharp:master Jul 11, 2012
@petejohanson
Copy link
Contributor

Thanks for the investigation and pull request!

@nicwise
Copy link
Contributor Author

nicwise commented Jul 11, 2012

No problem. Thankfully, once I got the confirmation of whats going on under the hood from Marek at Xamarin, it was an easy one. (Can't say I did much of the work tho :) )

@ayoung
Copy link
Contributor

ayoung commented Jul 11, 2012

Thanks Nic. Those Xamarin guys always have good support.

@nicwise
Copy link
Contributor Author

nicwise commented Jul 11, 2012

that they do. thanks for the help

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants