简体   繁体   中英

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

查找在SpaceShip.Program的静态构造函数或在任何方法外部初始化的静态变量中可能发生的错误(例如,私有静态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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM