[Mono-dev] [PATCH] MonoMethod.cs

Matthew Metnetsky met at uberstats.com
Fri Feb 27 09:50:48 EST 2009


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

To whom it may concern,

I was migrating some code from Mono 1.x to .NET 3.5 and came across a
very small bug. I was calling MonoMethod.Invoke like so:

MethodInfo method = type.GetMethod("Foo"); // Foo(int i, string name);

method.Invoke(obj,
              BindingFlags.ExactBinding,
              new CustomerBinder(),
              new object[]{"0", "one"},
              null);

When using Mono the code above works, but on .NET it does not because
BindingFlags.ExactBinding(1) apparently means that the Binder's
ChangeType method is not supposed to be called. Therefore the string "0"
is never converted to an int (as required by the signature for Foo).

I've attached a very small patch for this. Please let me know if there
is anything else I can do.

Regards,

~ Matthew

(1)
http://msdn.microsoft.com/en-us/library/system.reflection.bindingflags(VS.80).aspx
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iEYEARECAAYFAkmn/cQACgkQLrcoBjlTBf1bIQCfWMh9d9n7VGiUk7D1ziLtUixC
tiwAn1iet8LbeoVsviq8ywfuWKeLrgK5
=QIaU
-----END PGP SIGNATURE-----
-------------- next part --------------
A non-text attachment was scrubbed...
Name: MonoMethod.cs.diff
Type: text/x-patch
Size: 799 bytes
Desc: not available
Url : http://lists.ximian.com/pipermail/mono-devel-list/attachments/20090227/1aa1089b/attachment.bin 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: MonoMethod.cs.diff.sig
Type: application/pgp-signature
Size: 72 bytes
Desc: not available
Url : http://lists.ximian.com/pipermail/mono-devel-list/attachments/20090227/1aa1089b/attachment-0001.bin 


More information about the Mono-devel-list mailing list