title: TypeInitializationException: The type initializer for '<Module>' threw an exception
body: <p>I've googled and debugged extensively and I can't figure out what causes this exception.  Anecdotally re-installing the .NET framework sometimes fixes this, but it seems a little sketchy as a fix:</p>
  
  <pre><code>TypeInitializationException: The type initializer for '&amp;lt;Module&amp;gt;' threw an exception.
      The C++ module failed to load during appdomain initialization.
  
        The system cannot find the file specified
  
  StackTrace:
     at CModuleInitialize.LoadWpfGfx(CModuleInitialize* )
     at CModuleInitialize.{ctor}(CModuleInitialize* )
     at ?A0x828d0bb1.??__E?A0x828d0bb1@cmiStartupRunner@@YMXXZ()
     at _initterm_m((fnptr)* pfbegin, (fnptr)* pfend)
     at &amp;lt;CrtImplementationDetails&amp;gt;.LanguageSupport.InitializePerAppDomain(LanguageSupport* )
     at &amp;lt;CrtImplementationDetails&amp;gt;.LanguageSupport._Initialize(LanguageSupport* )
     at &amp;lt;CrtImplementationDetails&amp;gt;.LanguageSupport.Initialize(LanguageSupport* )
  </code></pre>
  
  <p>Any clues?</p>
  
  <p><strong>Context</strong></p>
  
  <p>This is a WinForms app, written in C# with a handful of new components written in WPF.  The crash reports we're getting don't include any more context than what I'm showing (stack trace, etc.) and we're not doing any C++, managed or otherwise.</p>
  
  <p>I haven't been able to reproduce this crash, but remote diagnosis of a few customers suggest that re-installing the .NET framework <em>may</em> fix this problem for that customer.</p>
  
  <p>Customers who report this crash do so several times and it appears they can't use the app until the .NET framework is re-installed, or they revert to an older version of the app that only used .NET 2.0</p>
  
  <p><strong>Links</strong></p>
  
  <p><a href="http://social.msdn.microsoft.com/Forums/en/clr/thread/a25a3424-8f07-44a3-87fc-263349318fd6" rel="noreferrer">Some links</a> indicate a possible connection between beta versions of the .NET Framework, or visual studio and this crash, but that doesn't seem likely in this case.</p>
  
  <p>Another possible connection may be with the Visual C++ 2005 redistributable.</p>