Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

My Windows Forms application was working earlier, however suddenly it stopped working. I am getting following exception:

enter image description here

With exception details as follows:

System.TypeInitializationException was unhandled
Message: An unhandled exception of type 'System.TypeInitializationException' occurred in mscorlib.dll
Additional information: The type initializer for 'NotificationTester.Program' threw an exception.

When I click OK, the VS windows then shows following:

enter image description here

The solution was working fine earlier. I don't get whats going wrong.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
409 views
Welcome To Ask or Share your Answers For Others

1 Answer

So: either one of the field-initializers, or the static constructor, for Program - is failing. Find out why. Note: the InnerException has the actual exception that was raised, but basicaly: just debug the field initializers and static constructor. So look inside the Program class for either:

static SomeType someField = /* some non-trivial expression or method call */ 

or:

static Program() {
    // stuff
}

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share

548k questions

547k answers

4 comments

86.3k users

...