New WinForm project is called Testil, which contains a form form1, compiles to generate an exe file, use
Reflector reflects the main function of Form1, the code is as follows:
.method private hidebysig static void Main () cil managed {.custom instance void [mscorlib] System.STAThreadAttribute :: ctor () // Code Size:. 11 byte (s) .maxstack 1 L_0000: newobj instance void TestIL.Form1: : .ctor () l_0005: Call void [system.windows.forms] system.windows.forms. Application :: run ([system.windows.forms] system.windows.forms.form) l_000a: Ret} use iLDASM Compile the same function, the code is as follows: .method private hidebysig static void? Main () CIL managed {? .Entrypoint // Note this? .Custom instance void [mscorlib] system.stathreadAttribute ::. Ctor () = (01 00 00 00 00 00 00 00)? // Code size ?????? 11 (0xB)? .Maxstack? 1? Il_0000 :? newobj ???? instance void testil.form1 ::. Ctor ()? Il_0005 :? call ??? ??? void [system.windows.forms] system.windows.Forms. Application :: run (class [system.windows.forms] system.windows.forms.form)? il_000a :? Ret} // end of method form1 :: MAINREFLEctor's anti-compilet code is not .EntryPoint, since the knowledge of this aspect is started, find the instructions for .EntryPoint in "Inside Microsoft .NET IL Assembler": .entrypoint Identifies The Current Method As The Entry Point of the application (the assembly). Each managed EXE file must have a single entry point.The ILAsm compiler will refuse to compile a module without a specified entry point, unless you use the / DLL command-line option. it seems .net own The tool insurance does not know if there are other reasons, please advise