RoR
RoR

Reputation: 16502

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.

Upvotes: 1

Views: 3561

Answers (3)

David
David

Reputation: 73604

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

Upvotes: 7

Will
Will

Reputation: 2532

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.

Upvotes: 0

Jon Sagara
Jon Sagara

Reputation: 1172

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();).

Upvotes: 1

Related Questions