When you link to an unmanaged library (say 'A.dll') which in turn links to another library ('B.dll'), and B.dll is missing, you will get a run-time error message about failing to load 'B.dll'.

But when you P/Invoke into 'A.dll' from managed code, you'll get a general exception of this form:

Unhandled Exception: System.DllNotFoundException: Unable to load DLL 'A.dll': The specified module could not be found.

How can I get an error message that pinpoints the specific unmanaged dll file that failed to load, when p/invoking from managed code ?