[Mono-bugs] [Bug 75519][Min] New - GetExportedTypes from Assembly loaded by ReflectionOnly causes NullRef in runtime

bugzilla-daemon at bugzilla.ximian.com bugzilla-daemon at bugzilla.ximian.com
Sun Jul 10 07:09:59 EDT 2005

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 at omega.pl.


--- shadow/75519	2005-07-10 07:09:59.000000000 -0400
+++ shadow/75519.tmp.15293	2005-07-10 07:09:59.000000000 -0400
@@ -0,0 +1,72 @@
+Bug#: 75519
+Product: Mono: Runtime
+Version: 1.0
+OS Details: mono svn
+Status: NEW   
+Priority: Minor
+Component: misc
+AssignedTo: mono-bugs at ximian.com                            
+ReportedBy: nazgul at omega.pl               
+QAContact: mono-bugs at ximian.com
+TargetMilestone: ---
+Summary: GetExportedTypes from Assembly loaded by ReflectionOnly causes NullRef in runtime
+Please fill in this template when reporting a bug, unless you know what you
+are doing.
+Description of Problem:
+I try to load System.Xml.dll and System.dll by ReflectionOnly and then
+query types in System.dll. But in this last operation runtime crashes.
+Steps to reproduce the problem:
+1. Compile and run with gmcs
+class M {
+  static void Main () {
+     System.Reflection.Assembly x1 =
+System.Reflection.Assembly.ReflectionOnlyLoadFrom (typeof
+     System.Reflection.Assembly x2 =
+System.Reflection.Assembly.ReflectionOnlyLoadFrom (typeof
+      System.Type[] ty = x2.GetExportedTypes ();
+  }
+Actual Results:
+Unhandled Exception: System.NullReferenceException: Object reference not
+set to an instance of an object
+in <0x00000> <unknown method>
+in (wrapper managed-to-native) System.Reflection.Assembly:GetTypes (bool)
+in <0x0000c> System.Reflection.Assembly:GetExportedTypes ()
+in <0x00060> M:Main ()
+Expected Results:
+Clear run
+How often does this happen? 
+Additional Information:
+One thing to note is that MS.NET uses some strange requirement on loading
+dependencies first (by for example mscorlib.dll seems to be already
+loaded). If I remove loading the System.Xml they crash with
+Unhandled Exception: System.IO.FileLoadException: Can not resolve
+dependency to file 'System.Xml' because the file has not been preloaded.
+ReflectionOnly assemblies can only be loaded explicitly using
+ReflectionOnly apis.
+   at System.Reflection.Assembly.GetExportedTypes()
+   at M.Main()
+Unknown signal 79
+(this is with Beta1, maybe something changed in Beta2 though)

More information about the mono-bugs mailing list