[mono-android] Reflection - Cannot find default constructor

Willem Meints willemm at infosupport.com
Fri Mar 25 09:11:57 EDT 2011


Never mind. I should have put a [Preserve] attribute above the constructor.
Otherwise it's removed. :S

________________________________
Van: monodroid-bounces at lists.ximian.com [monodroid-bounces at lists.ximian.com] namens Willem Meints [willemm at infosupport.com]
Verzonden: vrijdag 25 maart 2011 13:51
Aan: monodroid at lists.ximian.com
Onderwerp: [mono-android] Reflection - Cannot find default constructor

Hi,

Before I start firing up a browser and send a bugreport about this it's probably a good idea to check with you guys first.

The problem I'm experiencing is that the Newton JSON library cannot find a default constructor on a type I'm trying to deserialize. Since it works fine on other platforms I thought that it might be a problem with MonoDroid behaving incorrectly. So here's what I've tried:

Type type = typeof(IdentityProviderInformation);
ConstructorInfo constructor = type.GetConstructor(BindingFlags.Public | BindingFlags.Instance,null,new Type[0], null);

if(constructor != null)
{
  Log.Info("MyApp","Constructor found");
}

The result is that the app doesn't find the constructor and doesn't print the message into the log. The type has a default constructor, so it should find it.

Can someone confirm this behavior?

Best regards,

Willem Meints
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.ximian.com/mailman/private/monodroid/attachments/20110325/bb14564e/attachment-0001.html 


More information about the Monodroid mailing list