bugDotGNU Portable.NET - Bugs: bug #4468, PInvoke does not throw...

 
 

You are not allowed to post comments on this tracker with your current authentication level.

bug #4468: PInvoke does not throw System.DllNotFoundException

Submitted by:  Yannis BRES <yannis_bres>
Submitted on:  Fri 25 Jul 2003 09:11:57 AM UTC  
 
Category: NoneSeverity: 3 - Normal
Item Group: NoneStatus: Fixed
Privacy: PublicAssigned to: None
Open/Closed: Closed

Mon 28 Jul 2003 08:04:14 AM UTC, comment #1:

Fix committed to CVS - 28 July 2003

Rhys Weatherley <rweather>
Project Administrator
Fri 25 Jul 2003 09:11:57 AM UTC, original submission:

When invoking a function imported from a dynamic library that cannot be found, a System.DllNotFoundException should be thrown. Instead, error messages ("could not load dynamic library") are output in the different versions of ILDynLibraryOpen in pnet/support/dynlib.c. These messages should be removed and I guess that ILDynLibraryOpen should silently return 0.
I guess that pnet/engine/convert.c should be updated to throw System.DllNotFoundException when ILDynLibraryOpen returns 0, but I don't know how to do it ;-).
Also, pnet/ilnative/ilcheck.c should be updated as it relies on ILDynLibraryOpen to output an error message in case of failure.
Here is a little test program.
ilrun output:
--------------------------------------------------
zobzob.dll: could not load dynamic library
Failed in calling a dummy function from a dummy DLL:
System.MissingMethodException: Attempted to access a non-existing method
at Test_PInvoke.Main()

DummyFunctionInExistingDLL: could not resolve symbolFailed in calling a dummy function from an existing DLL:
System.MissingMethodException: Attempted to access a non-existing method
at Test_PInvoke.Main()

Succeeded in calling SHGetFolderPath: C:\Windows\System32
--------------------------------------------------
MS VM output:
--------------------------------------------------
Failed in calling a dummy function from a dummy DLL:
System.DllNotFoundException: Unable to load DLL (zobzob.dll).
at Test_PInvoke.DummyFunctionInDummyDLL()
at Test_PInvoke.Main()
Failed in calling a dummy function from an existing DLL:
System.EntryPointNotFoundException: Unable to find an entry point named DummyFunctionInExistingDLL in DLL shell32.dll.
at Test_PInvoke.DummyFunctionInExistingDLL()
at Test_PInvoke.Main()
Succeeded in calling SHGetFolderPath: C:\Windows\System32
--------------------------------------------------
Have fun,

Yannis BRES <yannis_bres>

 

Attached Files
file #558:  Test_PInvoke.cs added by yannis_bres (2KiB - text/plain)

 

Depends on the following items: None found

Items that depend on this one: None found

 

CC list is empty

 

Do you think this task is very important?
If so, you can click here to add your encouragement to it.
This task has 0 encouragements so far.

Only logged-in users can vote.

 

Please enter the title of George Orwell's famous dystopian book (it's a date):

 

 

Follow 2 latest changes.

Date Changed By Updated Field Previous Value => Replaced By
Mon 28 Jul 2003 08:04:14 AM UTCrweatherStatusNone=>(Error - Not Found)
  Open/ClosedOpen=>(Error - Not Found)

Back to the top


Powered by Savane 3.1-cleanup1