Trying to setup my laptop to edit and run my C# application which called C++ dll. compile is ok, but when I run it, TypeInitializationException was unhandled error happened.
It said: The type initializer for '<Module>' threw an exception.
I also installed Visual Studio 2008 sp1.
No any problem at my desktop computer. Same OS, windows XP.
any idea?
Run the app under the debugger and take a look at the
InnerExceptionproperty – it should tell you what failed.Alternatively, set up the debugger to break on every exception, instead of the default behaviour of only breaking on unhandled exceptions. It should take you to the line of code that fails.
If that doesn’t help, and you built the C++ DLL yourself, turn on unmanaged debugging via the properties for the C# project. This will allow you to step into the C++ code and track down the original error.