This problem of mine has me pulling my hair out. It's related to the issue I had earlier with needing to write a Mutex that will get destroyed when going out of scope. It turns out that I was stupid and didn't need the Mutex -- the things I needed to lock out wouldn't observe the lock because they were actually being called from the same thread. I hadn't realized that one set of calls was coming from a Timer. Oops.
Anyhow, I'm doing some investigation to try to help narrow down the cause of our problems with that 3rd party DLL. They seem to believe that if we have multiple copies of their C DLLs (we'll call them a.dll and b.dll for now) in different folders, local only to the C# assemblies that use them, then life will be good and I can finally go home and actually see my family.
The proposed folder structure looks something like this:
+--App folder
+--DeviceA.dll
+--a.dll (linked to by DeviceA)
+--b.dll (linked to by a.dll)
+--Device B Folder
+--DeviceB.dll
+--a.dll
+--b.dll
My problem is that even though DeviceB.dll is in a separate folder, when it is loaded, it doesn't load and look for its dependencies in the Device B Folder -- it looks in the App folder instead. I really need to be able to guarantee that it's linking to a totally different DLL than the one that's in the App folder.
I've looked into the build properties, read some things on manifests, and haven't figured it out yet. Is this even possible? If I know that DeviceB.dll is in a different folder, do I have to set CurrentDirectory or something similar to force it to link to the DLLs in its own folder, instead of from the executing assembly's folder?
EDIT-- actually, the a.dll in "Device B Folder" should be c.dll. So a.dll links to b.dll, and c.dll links to b.dll. I can't change this behavior because the 3rd party DLL is already compiled to link to b.dll.