Bug 316005 (MONO65758) - NullReferenceException when runtime is unable to locate assembly
Summary: NullReferenceException when runtime is unable to locate assembly
Status: RESOLVED MOVED
Alias: MONO65758
Product: Mono: Runtime
Classification: Mono
Component: misc (show other bugs)
Version: unspecified
Hardware: Other Other
: P3 - Medium : Normal
Target Milestone: ---
Assignee: Mono Bugs
QA Contact: Mono Bugs
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2004-09-12 10:56 UTC by Gert Driesen
Modified: 2007-09-15 21:24 UTC (History)
0 users

See Also:
Found By: ---
Services Priority:
Business Priority:
Blocker: ---
Marketing QA Status: ---
IT Deployment: ---


Attachments
gzipped tar containing a repro for this issue (2.07 KB, application/octet-stream)
2004-09-12 10:57 UTC, Thomas Wiest
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Thomas Wiest 2007-09-15 18:53:23 UTC


---- Reported by gert.driesen@pandora.be 2004-09-12 03:56:20 MST ----

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.



---- Additional Comments From gert.driesen@pandora.be 2004-09-12 03:57:58 MST ----

Created an attachment (id=166762)
gzipped tar containing a repro for this issue




---- Additional Comments From vargaz@gmail.com 2004-10-30 20:54:08 MST ----

*** https://bugzilla.novell.com/show_bug.cgi?id=MONO65595 has been marked as a duplicate of this bug. ***



---- Additional Comments From vargaz@gmail.com 2006-04-17 16:21:26 MST ----



*** This bug has been marked as a duplicate of https://bugzilla.novell.com/show_bug.cgi?id=MONO76661 ***

Imported an attachment (id=166762)

Unknown operating system unknown. Setting to default OS "Other".
This bug was marked DUPLICATE in the database it was moved from.
    Changing resolution to "MOVED"