[Mono-bugs] [Bug 32992][Nor] New - Binder error when using PropertyInfo.GetValue
bugzilla-daemon@rocky.ximian.com
bugzilla-daemon@rocky.ximian.com
29 Oct 2002 19:17:44 -0000
Please do not reply to this email- if you want to comment on the bug, go to the
URL shown below and enter your comments there.
Changed by gonzalo@ximian.com.
http://bugzilla.ximian.com/show_bug.cgi?id=32992
--- shadow/32992 Tue Oct 29 14:17:44 2002
+++ shadow/32992.tmp.390 Tue Oct 29 14:17:44 2002
@@ -0,0 +1,67 @@
+Bug#: 32992
+Product: Mono/Class Libraries
+Version: unspecified
+OS: All
+OS Details:
+Status: NEW
+Resolution:
+Severity:
+Priority: Normal
+Component: CORLIB
+AssignedTo: mono-bugs@ximian.com
+ReportedBy: gonzalo@ximian.com
+QAContact: mono-bugs@ximian.com
+TargetMilestone: ---
+URL:
+Cc:
+Summary: Binder error when using PropertyInfo.GetValue
+
+This program:
+
+using System;
+using System.Reflection;
+
+class ClassInstance
+{
+ public object this [int index]
+ {
+ get {
+ return "This is the indexer for int. Index: " + index;
+ }
+ }
+
+ public object this [string index]
+ {
+ get {
+ return "This is the indexer for string. Index: " + index;
+ }
+ }
+
+ static void Main ()
+ {
+ ClassInstance c = new ClassInstance ();
+ Type t = typeof (ClassInstance);
+ PropertyInfo prop = t.GetProperty ("Item", new Type [] { typeof (string) });
+ if (prop == null) {
+ Console.WriteLine ("prop is null");
+ return;
+ }
+
+ object [] args = new object [] { "this is a string" };
+ prop.GetValue (c, args);
+ }
+}
+
+throws an exception when run under mono:
+Unhandled Exception: System.ArgumentException: parameters
+in <0x0008c> 00 System.Reflection.MonoMethod:Invoke
+(object,System.Reflection.BindingFlags,System.Reflection.B
+inder,object[],System.Globalization.CultureInfo)
+in <0x000fb> 00 System.Reflection.MonoProperty:GetValue
+(object,System.Reflection.BindingFlags,System.Reflecti
+on.Binder,object[],System.Globalization.CultureInfo)
+in <0x0002e> 00 System.Reflection.PropertyInfo:GetValue (object,object[])
+in <0x00125> 00 .ClassInstance:Main ()
+
+Under MS runtime it works fine. It prints:
+This is the indexer for string. Index: this is a string