Execution process for managed code
Managed execution process includes the following steps:
Choosing the right compiler
.Net Framework is a multilanguage execution environment, the runtime supports a wide variety of data types and language features. In order to obtain the full benefits provided by the common language runtime , you should use one or more language (VB.Net, C# etc.) compilers that target the runtime
Compiling the code to MSIL
Unlike the execution style of compiling source code into machine level code, .Net language compilers translates the source code into Microsoft Intermediate Language. This ensures language interoperability because no matter which language has been used to develop the application, it always gets translated to Microsoft Intermediate Language. During the compile time the compiler produces metadata, that contains description of the program like dependencies, versions etc
Compiling MSIL to native code
Before the program execution , Jist In Time compiler (JIT) compiles the MSIL into native code and stores it in a memory buffer. During JIT compilation, the code is also checked for type safety. Type safety ensures that objects are always accessed in a compatible way. The compiled native code is in memory and is not persisted. So every time we run our application this whole thing has to happen again.
Excecution of Code
After translating the IL into native code, it is sent to .Net runtime manager. The .Net runtime manager executes the code. During execution, managed code receives services such as garbage collection, security, interoperability with unmanaged code, cross-language debugging support, and enhanced deployment and versioning support.
- Difference between NameSpace and Assembly
- What is an Asssembly Qualified Name
- How to Assembly versioning
- Add and remove an assembly from GAC
- What is Native Image Generator (Ngen.exe)?
- How to force Garbage Collection
- Difference between CType and DirectCast
- Obsolete or Deprecated in NET Framework
- What is lazy initialization
- Difference between Clone and Copy
- Difference between Finalize() and Dispose()
- Difference between static and constant