Overview Notes

.Net PE (Portable Executable) Execution

 

Steps for PE Execution

  1. OS loader loads and starts executing the executable file.

  2. OS loader detects that the .exe file is a .NET PE file.

  3. OS starts up a copy of the CLR (mscore.dll) and passes control to it.

  4. CLR finds the entry point (Main or WinMain) of the .exe.

  5. CLR finds the class that contains Main or WinMain and loads it.

  6. If the class has not been loaded, locate it. Look in

    Cache the location information so it is available to .NET when the class is loaded again.

    Place a flag in code for each method to mark that class has already been loaded.

  7. Initalize static variables.

  8. When a method is invoked for the first time, verify that the

  9. On first execution of a method, compile IL code into native machine instructions (including optimizations) and pass control to it.

  10. On subsequent executions of a method, execute the compiled code.