[Mono-bugs] [Bug 41974][Cos] Changed - Illegal ArgumentNullException throw for the dynamic creation of object
bugzilla-daemon@rocky.ximian.com
bugzilla-daemon@rocky.ximian.com
Tue, 29 Apr 2003 04:47:12 -0400 (EDT)
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 gfr@skynet.be.
http://bugzilla.ximian.com/show_bug.cgi?id=41974
--- shadow/41974 Sun Apr 27 16:25:53 2003
+++ shadow/41974.tmp.3536 Tue Apr 29 04:47:12 2003
@@ -73,6 +73,123 @@
Best regards,
Gilles
------- Additional Comments From miguel@ximian.com 2003-04-27 16:25 -------
Please provide a complete program to test with.
+
+------- Additional Comments From gfr@skynet.be 2003-04-29 04:47 -------
+Hello Mr Miguel de Icaza,
+
+As you Requested a sample, i've given you one:
+
+Step to reproduce the problem:
+
+1 . Copy the following content inside a file called sample.cs
+
+>>> SOT >>>
+using System;
+using System.Reflection;
+
+
+namespace Test4
+{
+ public class DynamicClass
+ {
+ public DynamicClass (System.String arg)
+ {
+ System.Console.Out.WriteLine ("DynamicClass - inside the .ctor
+with arg = '{0}'", arg);
+ }
+ }
+
+
+ public class StaticClass
+ {
+ static public void Main ()
+ {
+ System.Object obj;
+ System.Type type = typeof (DynamicClass);
+
+
+ if (type == null)
+ {
+ System.Console.Out.WriteLine ("ERROR - Impossible to produce
+the test");
+ }
+
+
+ try
+ {
+ obj = type.InvokeMember (null,
+ System.Reflection.BindingFlags.Default |
+System.Reflection.BindingFlags.CreateInstance,
+ null,
+ null,
+ new System.Object [] { "One Argument" });
+ }
+
+
+
+
+ catch (System.ArgumentNullException ex)
+ {
+ obj = null;
+ System.Console.Out.WriteLine ("Exception catched - {0}",
+ex.ToString ());
+ }
+
+
+ if (obj != null)
+ {
+ System.Console.Out.WriteLine ("Test Successfull");
+ }
+ else
+ {
+ System.Console.Out.WriteLine ("Test fail");
+ }
+ }
+ }
+}
+>>> EOT >>>
+
+2. Compile it with the following command:
+
+ mcs -target:exe -out:sample.exe sample.cs
+
+3. Execute it with:
+
+ mono sample.exe
+
+==> The result under the microsoft dotnet version 1.0 is
+
+DynamicClass - inside the .ctor with arg = 'One Argument'
+Test Successfull
+
+==> The result under the mono runtime (cvs of Apr 26, 2003)
+
+Exception catched - System.ArgumentNullException: Argument cannot be null
+Parameter name: name
+in <0x001c2> 00 System.MonoType:InvokeMember
+(string,System.Reflection.BindingFlags,System.Reflection.Binder,object,object[],System.Reflection.ParameterModifier[],System.Globalization.CultureInfo,string[])
+in <0x0002f> 00 System.Type:InvokeMember
+(string,System.Reflection.BindingFlags,System.Reflection.Binder,object,object[])
+in <0x000ac> 00 Test4.StaticClass:Main ()
+
+
+Test fail
+
+
+==> Remarks:
+
+Personnally, It think that the better way to make the call is to use
+for the parameter called 'name' of the method InvokeMember the value
+getted from System.String.Empty.
+
+I've put this entry only in order to get a greater compatibility
+between the Microsoft and the Ximian dotnet.
+
+I've believe that if this difference is not fixed, it would be great
+to create a porting how-to or a good dotnet programming how-to.
+
+Best Regards,
+Gilles