[Mono-bugs] [Bug 73469][Min] New - System.Type.IsAssignableFrom executed on array types causes runtime to throw NullRefExc
bugzilla-daemon@bugzilla.ximian.com
bugzilla-daemon@bugzilla.ximian.com
Tue, 8 Mar 2005 07:43:59 -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 nazgul@omega.pl.
http://bugzilla.ximian.com/show_bug.cgi?id=73469
--- shadow/73469 2005-03-08 07:43:59.000000000 -0500
+++ shadow/73469.tmp.30956 2005-03-08 07:43:59.000000000 -0500
@@ -0,0 +1,77 @@
+Bug#: 73469
+Product: Mono: Runtime
+Version: unspecified
+OS:
+OS Details: Mandrake 10.1 mono 1.1.4.20040221svn
+Status: NEW
+Resolution:
+Severity:
+Priority: Minor
+Component: misc
+AssignedTo: mono-bugs@ximian.com
+ReportedBy: nazgul@omega.pl
+QAContact: mono-bugs@ximian.com
+TargetMilestone: ---
+URL:
+Cc:
+Summary: System.Type.IsAssignableFrom executed on array types causes runtime to throw NullRefExc
+
+Please fill in this template when reporting a bug, unless you know what you
+are doing.
+Description of Problem:
+This bug is related to http://bugzilla.ximian.com/show_bug.cgi?id=70838
+but for array types
+
+Steps to reproduce the problem:
+1. Compile following program
+
+using System;
+using System.Reflection;
+
+using System.Reflection.Emit;
+class X {
+
+static void Main ()
+{
+AssemblyName asmname = new AssemblyName();
+asmname.Name = "assemfilename.exe";
+AssemblyBuilder asmbuild = System.Threading.Thread.GetDomain().
+DefineDynamicAssembly(asmname, AssemblyBuilderAccess.RunAndSave);
+ModuleBuilder modbuild = asmbuild.DefineDynamicModule("modulename",
+"assemfilename.exe");
+
+Type icomparable = typeof (System.IComparable[]);
+
+TypeBuilder typebuild1 = modbuild.DefineType("typename",
+TypeAttributes.Public, null, new Type[] { icomparable });
+ string rankstr = "[]";
+Type ty = modbuild.GetType (typebuild1.FullName + rankstr);
+
+System.Console.WriteLine (icomparable.IsAssignableFrom (ty));
+
+typebuild1.CreateType();
+
+asmbuild.Save("assemfilename.exe");
+
+}
+}
+
+
+2. Run it
+
+Actual Results:
+
+Unhandled Exception: System.NullReferenceException: Object reference not
+set to an instance of an object
+in <unknown method>
+in <0x00004> System.Type:type_is_assignable_from (System.Type , System.Type )
+in <0x0007e> System.Type:IsAssignableFrom (System.Type c)
+in <0x00113> X:Main ()
+
+Expected Results:
+True
+
+How often does this happen?
+Always - with both RunAndSave and Save attributes
+
+Additional Information: