[Mono-bugs] [Bug 639819] New: Assembly.Load() should throw FileLoadException instead of FileNotFoundException
bugzilla_noreply at novell.com
bugzilla_noreply at novell.com
Thu Sep 16 10:55:35 EDT 2010
https://bugzilla.novell.com/show_bug.cgi?id=639819
https://bugzilla.novell.com/show_bug.cgi?id=639819#c0
Summary: Assembly.Load() should throw FileLoadException instead
of FileNotFoundException
Classification: Mono
Product: Mono: Class Libraries
Version: 2.6.x
Platform: All
OS/Version: All
Status: NEW
Severity: Normal
Priority: P5 - None
Component: CORLIB
AssignedTo: mono-bugs at lists.ximian.com
ReportedBy: knocte at gmail.com
QAContact: mono-bugs at lists.ximian.com
Found By: ---
Blocker: ---
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.2; en-GB; rv:1.9.2.9)
Gecko/20100824 Firefox/3.6.9 ( .NET CLR 3.5.30729; .NET4.0E)
In case a developer wants to load an assembly from a path, he can be confused
at first and use Assembly.Load() instead of Assembly.LoadFile().
In this case, the developer doesn't get good feedback of what went wrong,
because the file is there and it exists, but a FileNotFoundException with the
path is thrown.
Reproducible: Always
Steps to Reproduce:
1. Place a managed and valid dll in /home/myself/ as the name "hello.dll".
2. Use Assembly.Load ("/home/myself/hello.dll")
3. Place your exe in /home/myself/.
4. Run it.
Actual Results:
Unhandled Exception: System.IO.FileNotFoundException: Could not load file or
assembly '/home/myself/hello.dll' or one of its dependencies. The system cannot
find the file specified.
File name: '/home/myself/hello.dll'
Expected Results:
MS.NET is a bit better at this, but still not perfect.
MS.NET throws:
System.IO.FileLoadException: Could not load file or assembly
'C:\\VersionToleran
tSerializationTestLib.dll' or one of its dependencies. The given assembly name
o
r codebase was invalid. (Exception from HRESULT: 0x80131047)
File name: 'C:\\VersionTolerantSerializationTestLib.dll'
What we should throw:
System.IO.FileLoadException: Could not load assembly '/home/myself/hello.dll'
or one of its dependencies. The given assembly name or codebase was invalid.
(Exception from HRESULT: 0x80131047)
File name: '/home/myself/home/myself/hello.dll.dll'
NOTE: The last filename is not a typo.
When running the program with strace, even though the FileNotFoundException
reports /home/myself/hello.dll as the path, the actual syscall operation for
opening the file is trying to open '/home/myself/home/myself/hello.dll.dll'
--
Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA contact for the bug.
You are the assignee for the bug.
More information about the mono-bugs
mailing list