[Mono-bugs] [Bug 639532] New: Should throw BadImageFormatException instead of DllNotFoundException

bugzilla_noreply at novell.com bugzilla_noreply at novell.com
Wed Sep 15 09:11:05 EDT 2010


https://bugzilla.novell.com/show_bug.cgi?id=639532

https://bugzilla.novell.com/show_bug.cgi?id=639532#c0


           Summary: Should throw BadImageFormatException instead of
                    DllNotFoundException
    Classification: Mono
           Product: Mono: Runtime
           Version: 2.6.x
          Platform: Other
        OS/Version: Other
            Status: NEW
          Severity: Normal
          Priority: P5 - None
         Component: misc
        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 MS.NET if you try to call unmanaged code via DllImport to a foo.dll file,
and the file is there but it's corrupt or cannot be loaded, the output is:


Unhandled Exception: System.BadImageFormatException: An attempt was made to
load
 a program with an incorrect format. (Exception from HRESULT: 0x8007000B)
   at Test.MainClass.hello()
   at Test.MainClass.Main(String[] args) in C:\Documents and Settings\andres\My
Documents\Test\Main.cs:line 19


However Mono outputs:

Unhandled Exception: System.DllNotFoundException: foo.so
   at Test.MainClass.hello()
   at Test.MainClass.Main(String[] args) in C:\Documents and Settings\andres\My
Documents\Test\Main.cs:line 19

Reproducible: Always




This is very confusing because the user that is using Mono may think that Mono
is not finding the DLL, trying to look for docs about working directory,
LD_LIBRARY_PATH, etc...

-- 
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