Explain CLI, CIL, CTS, Metadata, CLS, IL and VES in .NET
CLI - Common Language Infrastructure. Microsoft has a piece of shared source, its the
public implementation of ECMA Common Language Infrastructure. This shared code is code-named
"Rotor". It has around 3 million lines of code. Those who are interesed in development of
a language that targets the .NET Framework, may extensively make use of this CLI. The following
topics are covered in the Shared Source CLI :
CLI CTS Metadata CLS IL VES
Code Access Security
* The CLI type system
* Component packing & assemblies
* Type Loading & JIT Compilatino
* Managed code & Execution Engine (CLR)
* Description of Garbage Collection process & memory management
* The Platform Adaptation Layer (PAL): a portability layer for Win32®, Mac OS® X, and FreeBSD
Its been written by the Microsoft Team that has developed the .NET Framework.
Note: A compiled managed assembly is comprised of IL, Metadata and Manifest.
CIL Stands for Common Intermediate Language. Its actually a low level human readable language
implementation of CLI. All .NET-aware languages compile the source oode to an intermediate language
called Common Intermediate Language using the language specific compiler. It is also possible to build
.NET assemblies direclty using CIL using the ilasm.exe compiler. This compiler is shipped along
with the .NET Framework 2.0 SDK. CIL is the only language that allows access to each aspect of the CTS.
CIL is the definition of the fundamentals of the .NET framework.
CTS - stands for Common Type Specification. It is at the core of .NET Framework's cross-language
integration, type safety, and high-performance code execution. It defines a common set of types that
can be used with many different language syntaxes. Each language (C#, VB.NET, Managed C++, and so on)
is free to define any syntax it wishes, but if that language is built on the CLR, it will use at least
some of the types defined by the CTS.
Metadata - is code that describes the compiled IL. A .NET language compiler will generate the
metadata and store this in the assembly containing the CIL. Metadata describes all class members and classes
that are defined in the assembly, and the classes and class members that the current assembly will call
from another assembly. The metadata for a method contains the complete description of the method, including
the class (and the assembly that contains the class), the return type and all of the method parameters.
When the CLR executes CIL it will check to make sure that the metadata of the called method is the same as the
metadata that is stored in the calling method. This ensures that a method can only be called with exactly
the correct number of parameters and exactly the correct parameter types.
CLS - Common Language Specification. A type that is CLS compliant, may be used across any .NET
language. CLS is a set of language rules that defines language standards for a .NET language and types
declared in it. While declaring a new type, if we make use of the [CLSCompliant] attribute, the
type is forced to conform to the rules of CLS.
IL - Intermediate Language, is the compiled form of the .NET language source code. When .NET source
code is compiled by the language specific compiler (say we compile C# code using csc.exe), it is compiled to
a .NET binary, which is platform independent, and is called Intermediate Language code. The .NET binary
also comprises of metadata.
Its important to note here that metadata describes the IL, whereas manifest describes
VES - Virtual Execution System.
The Virtual Execution System(VES) provides an environment for executing managed code. It provides direct support
for a set of built-in data types, defines a hypothetical machine with an associated machine model and state, a
set of control flow constructs, and an exception handling model.To a large extent, the purpose of the VES is
to provide the support required to execute the Common Intermediate Language instruction set.