Latest update Android YouTube

Life Cycle of DOT Net Project Execution

Life Cycle of DOT Net Project Execution | IndianTechnoera

.NET Project Execution Lifecycle (From Code to Execution)

When you create and run a .NET application, several steps occur internally to transform your source code into a running program. Understanding this sequence helps developers debug better, optimize performance, and answer interview questions confidently.

1. Writing the Source Code

You start by writing code in a .NET supported language such as C#, VB.NET, or F#. Example: creating a HelloWorld.cs file in C#.

2. Compilation into MSIL/CIL

The language-specific compiler (e.g., csc.exe for C#) compiles the source code into MSIL (Microsoft Intermediate Language), also called CIL (Common Intermediate Language). This IL code is platform-independent and cannot run directly on the machine.

3. Creation of Assemblies

The compiled IL code is stored inside an Assembly. Assemblies are the basic deployment units in .NET and can be:

  • .exe – Executable assemblies
  • .dll – Library assemblies

Assemblies also include metadata (information about classes, methods, references) and optional resources (images, config files, etc.).

4. Loading the CLR

When you run the application, the CLR (Common Language Runtime) is loaded. The CLR is the heart of .NET execution. It provides:

  • Memory management and Garbage Collection
  • Type safety and Security checks
  • Exception handling
  • Thread management

5. JIT Compilation (IL → Native Code)

The IL code is converted into machine-specific native code by the JIT (Just-In-Time) Compiler. This happens at runtime, just before execution. Types of JIT:

  • Pre-JIT – Compiles the entire code at once (used in NGen).
  • Eco-JIT – Compiles code on demand, discarding after use.
  • Normal JIT – Compiles code on demand and saves it for reuse.

6. Execution of Native Code

After JIT compilation, the program runs as native machine instructions. At this stage:

  • The CPU executes the instructions.
  • CLR manages resources and memory.
  • Garbage Collector (GC) automatically frees unused objects.
  • Exceptions are caught and handled if they occur.

7. Role of FCL/BCL

During execution, your application may use thousands of ready-made classes from:

  • BCL (Base Class Library) – Core utilities (strings, dates, IO, collections).
  • FCL (Framework Class Library) – Extended functionality (web, XML, ADO.NET, etc.).

8. Program Ends

Once the program completes, the CLR ensures proper cleanup of resources, memory is freed by GC, and the application terminates safely.

Complete Sequence Recap

  1. Write source code (C#, VB.NET, F#)
  2. Compiler converts to MSIL/CIL
  3. Code stored in Assemblies (.exe / .dll with Metadata)
  4. CLR is loaded when program starts
  5. JIT converts IL to native machine code
  6. Native code executes on CPU
  7. CLR manages memory, security, exceptions
  8. FCL/BCL libraries support advanced features
  9. Garbage Collector cleans up
  10. Program terminates safely

إرسال تعليق

Feel free to ask your query...
Cookie Consent
We serve cookies on this site to analyze traffic, remember your preferences, and optimize your experience.
Oops!
It seems there is something wrong with your internet connection. Please connect to the internet and start browsing again.
AdBlock Detected!
We have detected that you are using adblocking plugin in your browser.
The revenue we earn by the advertisements is used to manage this website, we request you to whitelist our website in your adblocking plugin.
Site is Blocked
Sorry! This site is not available in your country.