I have a situation where I am using a third party library. On machines where the library is not installed, I am getting the excption: Unable to load DLL '*.dll': The specified module could not be found. (Exception from HRESULT: 0x8007007E)
. However, I am wrapping the calling code in a try-catch block.
I have tried catching both Exception and DllNotFoundException and neither actually catch the error. The app then closes ungracefully.
I would like for the app to catch the error, then continue without using the third-party functionality.
How can I either prevent the error with a dll check (without knowing the path) or gracefully catch the error.
Edit: More Details This is a third party app that allows me to use a usb device. They have provided a .net wrapper for their un-managed api (I think). I added the managed dll's to the project in the normal fashion.
Edit: I managed to get a path for the dll in question. I am doing a File.Exisits on the dll and not entering th code block if the dll does not exist. This seems to be working so far. Thanks for the help!