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:
TypeInitializationException: The type initializer for '<Module>' 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 <CrtImplementationDetails>.LanguageSupport.InitializePerAppDomain(LanguageSupport* )
at <CrtImplementationDetails>.LanguageSupport._Initialize(LanguageSupport* )
at <CrtImplementationDetails>.LanguageSupport.Initialize(LanguageSupport* )
Any clues?
Context
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.
I haven't been able to reproduce this crash, but remote diagnosis of a few customers suggest that re-installing the .NET framework may fix this problem for that customer.
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
Links
Some links 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.
Another possible connection may be with the Visual C++ 2005 redistributable.