What is JIT compiler in .Net and how it works?
JIT stands for Just in time compiler. JIT compiler converts the MSIL code to native executable code (.dll or .exe) which runs on the specific machine/computer. When we compile native .net code written in (C#, VB, F# or other language) using language compiler it produces MSIL code, which is further executed by the common language runtime. CLR invokes JIT compiler which reads the MSIL code and converts it to the native instructions for specific hardware or machine. As the name specifies just in time, JIT compiler only converts those part of the code which need to be executed.
What is an assembly?
Assembly is the
smallest building block in .
Net application. An assembly is a collection of types and resources that are built to work together and form a logical unit of functionality.
An assembly is a collection of types and resources that are built to work together and form a logical unit of functionality.
An assembly can be non-executable (.
dll) or executable (.
Assemblies can be of 3 types
Private assembly- These assemblies belong to the application and stored in the application itself.
Public/shared assembly- Global assemblies can be used by multiple applications at the same time and remain stored in GAC (Global assembly cache)
Satellite Assembly- contains static objects.
What is GAC?
Global assembly cache is the global storage/ common storage where all public assemblies remain stored. The default location of GAC for .Net framework 4.0 or later is
C:\Microsoft.Net\Assembly. The default location for Global assembly cache for the machine having the earlier version of .Net framework is
C:\Windows\Assembly. Global assembly cache stores all public assemblies which can be shared by different software/ applications installed on the machine.
We only need to keep those assemblies in GAC that need to be shared among applications otherwise it is recommended to keep assemblies as private.
What is Ildasm.exe used for?
ILDSAM stands for
IL Disassembler. It is a tool provided by the .Net framework to read MSIL code. ILDASM parses .Net framework .exe file or .dll file and generates human readable code. ILDASM parses .net assemblies and displays information like
Open ILDASM tool from Start -> All Program -> Microsoft Visual Studio -> Visual Studio Tools -> Developer Command Prompt
Run ILDSAM.exe command to open ILDSAM exe.
Below is the sample image displays output of an assembly.
What is portable executable (PE)?
PE stands for
Portable Executable. PE is a file format data structure that includes the information needed by Windows operating system to run .dll or .exe file. Whenever we compile our .Net application it generates PE files for each project in solution.