[Mono-bugs] [Bug 73432][Min] New - Type.InvokeMember with BindingFlags.CreateInstance doesn't work on `structure'
bugzilla-daemon@bugzilla.ximian.com
bugzilla-daemon@bugzilla.ximian.com
Mon, 7 Mar 2005 09:53:19 -0500 (EST)
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 ipknhama@gmail.com.
http://bugzilla.ximian.com/show_bug.cgi?id=73432
--- shadow/73432 2005-03-07 09:53:19.000000000 -0500
+++ shadow/73432.tmp.1853 2005-03-07 09:53:19.000000000 -0500
@@ -0,0 +1,71 @@
+Bug#: 73432
+Product: Mono: Runtime
+Version: 1.1
+OS:
+OS Details:
+Status: NEW
+Resolution:
+Severity:
+Priority: Minor
+Component: misc
+AssignedTo: mono-bugs@ximian.com
+ReportedBy: ipknhama@gmail.com
+QAContact: mono-bugs@ximian.com
+TargetMilestone: ---
+URL:
+Cc:
+Summary: Type.InvokeMember with BindingFlags.CreateInstance doesn't work on `structure'
+
+Description of Problem:
+When using Type.InvokeMember to create a new instance of structure
+(value-type), it cannot create a instance but throws exception.
+
+Steps to reproduce the problem:
+Compile and run this code. (file: a.cs)
+
+using System;
+using System.Reflection;
+
+namespace A{
+
+ struct B
+ {
+ int value;
+ }
+
+ public class A
+ {
+ public static void Main()
+ {
+ object o = typeof(B).InvokeMember("",
+BindingFlags.CreateInstance, null, null, null);
+ }
+ }
+}
+
+
+Actual Results:
+$ ./a.exe
+
+Unhandled Exception: System.MissingMethodException: Cannot find the
+requested method.
+in <0x00350> System.MonoType:InvokeMember
+(string,System.Reflection.BindingFlags,System.Reflection.Binder,object,object[],System.Reflection.ParameterModifier[],System.Globalization.CultureInfo,string[])
+in <0x0002a> System.Type:InvokeMember
+(string,System.Reflection.BindingFlags,System.Reflection.Binder,object,object[])
+in <0x00033> A.A:Main ()
+
+
+Expected Results:
+Run succesfully, with no message.
+
+
+How often does this happen?
+Always.
+
+Additional Information:
+This code works on MS .NET implementation.
+
+On implementation in MonoType.cs, it tries finding constructor (by
+GetConstructor) but it fails because there's not. I think there should be
+some additional code for handle value types(return Boxed object or something?).