title: Delay Load DLL: "Exception 0xC06D007E: Module not found" when application started multiple times
body: <p>I have a case of an intermittent crash in my application where we use Delay Load DLL.   There are a few different call-stacks where we have seen the crash, but it always crashes when raising <code>0xC06D007E: Module not found</code> in <code>__delayLoadHelper2</code>. </p>
  
  <p>The exception is raised when calling the process multiple times in a row (in series).  Here is a sample call stack:</p>
  
  <pre><code>KERNELBASE.dll!RaiseException()  + 0x3d bytes   
  MYDLL.dll!__delayLoadHelper2(const ImgDelayDescr * pidd=0x000000000012f650, __int64 (void)* * ppfnIATEntry=0x000000000012f570)  Line 331    C++
  MYDLL.dll!__tailMerge_MyDelayLoadDLL_dll()  + 0x3f bytes    Unknown
  MYDLL.dll!MyUserFunction()  Line 91 + 0x5 bytes C++
  </code></pre>
  
  <p>The c++ application is using Delay Load DLL to load .NET code.</p>
  
  <p>The computer on which the crash occurs is very powerful machine (12 cores CPU, 48 gig ram), I am not sure if it has an influence on it.  But since the crash does not happen all the time, it looks like a race condition, or resource issue.</p>
  
  <p><a href="http://social.msdn.microsoft.com/Forums/en/clr/thread/9f00bdf0-3ea7-4a1f-b5a7-9b5bbc009888" rel="nofollow noreferrer">This forum thread</a> describes my case, but there is no solution.</p>
  
  <p>Any idea why this could be happening? </p>