问题
What happen if a static constructor throws and exception and it is not handled?
Will it remain till the application domain alive?
回答1:
An unhandled exception in a static constructor, will be wrapped in a TypeInitializationException. If you're on .NET 2 or newer an unhandled exception will terminate the process.
回答2:
The exception will propagate and if it is not caught somewhere like for example a global exception handler it will simply kill the application domain.
回答3:
if an Exception happens in a static Constructor and you don't catch it, then you will never use its static Method , filed or property, even cann't create its instance, otherwise it will cause a TypeInitializationException.
来源:https://stackoverflow.com/questions/4579016/static-constructor-and-exceptions