I'm using Microsoft Visual Studio Express 2012 for Windows Desktop (Administrator)
I have a project library FOO.DLL
with "Copy to output directory" clicked to "Copy always".
Most of the time this DLL loads correctly and everybody is happy.
Sometimes, I get a System.DllNotFoundException
with message:
Additional information: Unable to load DLL 'FOO.DLL':
Invalid access to memory location. (Exception from HRESULT: 0x800703E6)
This error occurs both in Debug and Release. It occurs after a "clean" and after just running the same build a second or eighth time.
Is this an error in the DLL, the .NET runtime, or my .NET code?