Consider we have .NET Winforms application or Console Application. Can anyone tell me what will happen step-by-step until the WinForm or Console Application is launched. I would
When you double click on a .net .exe assembly:
You probably wants something like: Microsoft .NET Internals
http://www.amazon.com/Microsoft-NET-Internals-Tom-Christian/dp/0735626758/ref=sr_1_1?ie=UTF8&s=books&qid=1273233479&sr=1-1
Or since that's not released yet: Essential .NET, Volume I: The Common Language Runtime
http://www.amazon.co.uk/Essential-NET-Microsoft-Development-Paperback/dp/0201734117
The MSCoreEE.dll (MSCore Execution Engine.Dll only one instance for one machine) Say for example when a .Net assembly / .exe is double clicked or launched, the OS will load the windows loader which will inturn load the PE header (Portable executable) [in case of win32 executable, the PE header will contain the address of the bootstrap (static Main()) from where it will load and execute the main method, where as in .Net, the bootstrap will contain the address of MSCoreEE.Dll which will be present in C:\Windows\System32\mscoree.dll which will get executed and load the .Net runtime for which the .net assembly was targeted for. There can be multiple versions of .Net runtime installed on the machine, however, there will be only one instance of mscoreee.dll to load the specific runtimes.
The CLR will create the first APP domain itself and load the assembly (if the assembly didn’t create additional app domains in code)
The CLR creates 3 Application Domains internally 1. System App Domain a. is responsible to load Shared and Default application domains, also loads mscorelib.dll to shared app domain b. Create 3 seperates instances of Exceptions i. Fatal engine exception ii. Stack overflow exception iii. Out of memory exception (very important, the CLR precreates “out of memory” exception bcose when developer thinks the application can go out of memory and wants to write the exception to a log file, creating out of memory exception will take place because there was no memory left to create a new instance of this exception, so, CLR precreates this exception for future use in the application 2. Shared App Domain a. Contains the mscorlib.dll b. Other Common libraries which is used by other app domains c. However, the developer can’t push custom Dll’s into the shared app domain as its not controllable from outside of CLR, the CLR hosts these dll’s and CLR itself cannot be controlled of how it is hosted by a developer however its possible using some COM interfaces where the developer can host the CLR customary 3. Default App Domain a. All user binaries the .exe’s, Dlls gets loaded here