c# - Where is the information about the entry point of an assembly written in the assembly? -
i used think assembly have 1 main() method until saw jon skeet's miscutil in video lecture delivered @ microsoft office in copenhagen.
so, wrote little app had 2 main() methods so:
namespace manymains { class program { static void main(string[] args) { console.writeline("hello, world!"); console.readkey(); } } class yetanotherprogram { static void main() { console.writeline("yet program."); console.readkey(); } } }
i set startup object in visual studio , worked. okay, no cause distress. then, wanted see information stored in assembly, opened compiled binary in reflector , saw absolutely no metadata effect.
i'm wondering if sort of information written manifest or coff header of pe image can't seen in disassembler seen in hex editor?
i opened 1 of executables in il disassembler. notice .entrypoint line main method.
.method public hidebysig static void main() cil managed { .entrypoint .custom instance void [mscorlib]system.stathreadattribute::.ctor() = ( 01 00 00 00 ) .custom instance void [mscorlib]system.diagnostics.debuggernonusercodeattribute::.ctor() = ( 01 00 00 00 ) // code size 22 (0x16) .maxstack 1 .locals init ([0] class auctionsniper.main.app app) il_0000: nop ... <snipped>
vs non-entry point method - lets initializecomponent()
.method public hidebysig instance void initializecomponent() cil managed { .custom instance void [mscorlib]system.diagnostics.debuggernonusercodeattribute::.ctor() = ( 01 00 00 00 ) // code size 20 (0x14) .maxstack 8 il_0000: nop il_0001: ldarg.0 ... <snipped>
Comments
Post a Comment