C# Error when I try to compile
How do I go about resolving this issue? What other information can I look at?
An unhandled exception of type 'System.TypeInitializationException' occurred in Microsoft.VisualStudio.HostingProcess.Utilities.dll
Additional information: The type initializer for 'SpaceShip.Program' threw an exception.
From the documentation....
When a class initializer fails to initialize a type, a TypeInitializationException is created and passed a reference to the exception thrown by the type's class initializer. The InnerException property of the TypeInitializationException holds the underlying exception.
So look at the inner exception to find out where the real problem is.
http://msdn.microsoft.com/en-us/library/ms242144%28VS.80%29.aspx
And I assume you know this, but JUST in case.. How to check the Inner Exception: http://msdn.microsoft.com/en-us/library/hdwz4c0s%28VS.80%29.aspx
Look for errors that might occur in either SpaceShip.Program's static constructor, or in static variables that are initialized outside of any methods (e.g., private static Foo foo = new Foo();).
Exactly what the error says: The Type Initialiser (aka the Constructor) threw an error. Check the constructor of SpaceShip.Program. Perhaps run it through the debugger.
精彩评论