Winforms.Net application does not start

I have a standard winforms application that works on most machines. On a 2003 server with .Net 4 (full) installed, it does not start.

Event Viewer Shows:

Event Type: Error Event Source: .NET Runtime Event Category: None Event ID: 1026 Date: 4/01/2012 Time: 10:07:37 AM User: N/A Computer: DRACO Description: Application: start.exe Framework Version: v4.0.30319 Description: The process was terminated due to an unhandled exception. Exception Info: System.TypeInitializationException Stack: at BootStrap.Program.Main(System.String[]) Event Type: Error Event Source: .NET Runtime 4.0 Error Reporting Event Category: None Event ID: 1000 Date: 4/01/2012 Time: 10:07:34 AM User: N/A Computer: DRACO Description: Faulting application start.exe, version 1.0.4386.17553, stamp 4f0384f3, faulting module kernel32.dll, version 5.2.3790.4480, stamp 49c51f0a, debug? 0, fault address 0x0000bef7. 

It does not work when calling Main (), so I can not catch the errors. How to find out what the problem is?

+4
source share
2 answers

The exception is a TypeInitializationException . This is thrown when an exception is thrown executing the initializer code for the type. Basically a static constructor or initialization of static fields. Some of this initialization throws an exception, which raises a TypeInitializationException

The exception information itself will tell which type calls this via the TypeName property.

It is hard to say for sure what causes this problem. The quickest way to find out is to start the process under the debugger and set it to split into any exception that is thrown. This should immediately lead you to the root cause.

+8
source

The interesting part is this: System.TypeInitializationException

This means that one of the types used in your main method failed to initialize. Typically, a static constructor throws an exception, which is caught by the initializer, and then re-thrown as an internal exception of System.TypeInitializationException . Catch the exception in your main method and show its internal exception or use a debugger.

+8
source

Source: https://habr.com/ru/post/1389176/


All Articles