[Mono-bugs] [Bug 65758][Nor] New - NullReferenceException when runtime is unable to locate assembly

bugzilla-daemon@bugzilla.ximian.com bugzilla-daemon@bugzilla.ximian.com
Sun, 12 Sep 2004 03:56:21 -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 gert.driesen@pandora.be.

http://bugzilla.ximian.com/show_bug.cgi?id=65758

--- shadow/65758	2004-09-12 03:56:21.000000000 -0400
+++ shadow/65758.tmp.30935	2004-09-12 03:56:21.000000000 -0400
@@ -0,0 +1,81 @@
+Bug#: 65758
+Product: Mono: Runtime
+Version: unspecified
+OS: 
+OS Details: 
+Status: NEW   
+Resolution: 
+Severity: 
+Priority: Normal
+Component: misc
+AssignedTo: mono-bugs@ximian.com                            
+ReportedBy: gert.driesen@pandora.be               
+QAContact: mono-bugs@ximian.com
+TargetMilestone: ---
+URL: 
+Cc: 
+Summary: NullReferenceException when runtime is unable to locate assembly
+
+When the runtime tries to load a certain type that is referenced from an
+assembly that cannot be loaded, a NullReferenceException is thrown and some
+warnings are output.
+
+I've attached a tar containing an assembly "a" (a.exe) that initialize a
+type from assembly "b".
+
+However, assembly b is not available and when running a.exe, a
+FileNotFoundException should be thrown when the runtime tries to load the
+type from the assembly b.
+
+But the runtime instead reports some warnings, and throws a
+NullReferenceException :
+
+** (a.exe:10675): WARNING **: Could not find assembly b, references from
+/home/gert/mono-test-projects/test/a.exe (assemblyref_index=1)
+     Major/Minor: 0,0
+     Build:       0,0
+     Token:
+System error: No such file or directory
+
+
+** (a.exe:10675): WARNING **: Could not load class from token 0x01000004 in
+/home/gert/mono-test-projects/test/a.exe
+
+** (a.exe:10675): WARNING **: Missing method .ctor in assembly
+/home/gert/mono-test-projects/test/a.exe typeref index 4
+
+Unhandled Exception: System.NullReferenceException: Object reference not
+set to an instance of an object
+
+When running the same assembly on MS.NET, a FileNotFoundException is thrown
+and only relevant information is output :
+
+Unhandled Exception: System.IO.FileNotFoundException: File or assembly name
+b, or one of its dependencies, was not found.
+File name: "b"
+   at a.SomeClass.Main(String[] args)
+
+=== Pre-bind state information ===
+LOG: DisplayName = b, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null
+ (Fully-specified)
+LOG: Appbase = C:\assembly-loading-simple\test\
+LOG: Initial PrivatePath = NULL
+Calling assembly : a, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null.
+===
+
+LOG: Application configuration file does not exist.
+LOG: Policy not being applied to reference at this time (private, custom,
+partial, or location-based assembly bind).
+LOG: Post-policy reference: b, Version=0.0.0.0, Culture=neutral,
+PublicKeyToken=null
+LOG: Attempting download of new URL
+file:///C:/assembly-loading-simple/test/b.DLL.
+LOG: Attempting download of new URL
+file:///C:/assembly-loading-simple/test/b/b.DLL.
+LOG: Attempting download of new URL
+file:///C:/assembly-loading-simple/test/b.EXE.
+LOG: Attempting download of new URL
+file:///C:/assembly-loading-simple/test/b/b.EXE.
+
+Note : on MS.NET no information is output to stdout or stderr when you
+actually catch the FileNotFoundException.