Introduction to Evaluation
and
Overview of Dot Net Framework
Overview of Dot Net Framework
LEVEL – LEARNER
Icons Used
Hands on Exercise Reference Questions Points To Ponder
Coding Standards Lend A Hand Summary Test Your Understanding
2
Overview
The .NET Framework is an integral Windows
component that supports building and running
desktop applications and Web services.
It provides a managed execution environment,
simplified development and deployment, and
support for a wide variety of programming
languages.
Two key components are the Common Language
Runtime (CLR), which manages memory, code
execution, and other system services; and the .NET
Framework Class Library, which is a collection of
reusable types you can use to develop your
applications.
3
Objectives
•After completing this session, you will be able to:
– Identify the evolution of .NET Framework.
– Describe Command Language Runtime.
– Describe Common Type System.
– Describe Common Language Specifications.
– Recognize Assemblies.
– Recognize Runtime Host.
– Identify Memory Management.
4
.NET Framework Evolution History
Version Version Number Release Date Visual Studio Operating
System
1.0 1.0.3705.0 2002-02-13 VS.NET Windows 98 Released on 13 February 2002 and available for
Windows 98, Me, NT 4.0, 2000, and XP.
1.1 1.1.4322.573 2003-04-24 VS.NET 2003 Windows First version to be included as a part of the Windows
Server 2003 operating system, and shipping with Windows Server
2003
2.0 2.0.50727.42 2005-11-07 VS.NET 2005 Windows Released along with VS 2005,SQL Server 2005.
Server 2003 Has key features like : Generics, Membership provider,
R2 Partial classes
Nullable types, Anonymous methods integrators, Data
tables
3.0 3.0.4506.30 2006-11-06 VS.NET 2005 Vista, Server
2008 Integral part of windows 2008
Consists of Windows Presentation Foundation(WPF),
Windows Communication Foundation (WCF) , Windows
Work flow Foundation ( WF) and Card Space
3.5 3.5.21022.8 2007-11-19 VS.NET2008 Windows 7, technologies.
Server 2008
R2
On top of 3.0, key new features like, Extension
Methods, Lamda Expersion, LINQ were added in this
release.
4.0 4.0.30319.1 2010-04-12 Visual Studio Windows 7,
2010 Server 2008 Addition of Task Parallel Library, PLINQ, Statement
R2 Lambdas, CLR 3.0 and other language upgrades in .NET
4.0
5
.NET Framework Building Blocks
6
Dismantling the building blocks
.NET Framework supports multiple languages.
Means, you can use any .NET compliant language
of your choice for development.
For any language that needs to be part of .NET
framework should conform and comply to the
standards set by Microsoft, called Common
Language Specification (CLS)
It is a standard that specifies how Type
definitions and specific values of Types are
represented in computer memory. A data type in
one .NET language is same in another .NET
language. It ensures interoperability among .NET
languages.
A huge collection of reusable classes , interfaces,
and value types that helps to build applications
and provide access to system functionalities. Also
called as Base class Library
Technologies built with the above blocks with
which the developers develop different
applications.
CLR provides the execution platform for the
classes and applications that is getting developed
with these building blocks.
7
Common Type System
• The Common Type System (CTS) is a standard that specifies how Type
definitions and specific values of Types are represented in computer
memory.
• It is intended to allow programs written in different programming
languages to easily share information.
• establish a framework that helps enable cross-language integration,
type safety, and high performance code execution
• Provides an object oriented model that supports the complete
implementation of many programming languages.
• Defines rules that languages must follow, which helps ensure that
objects written in different languages can interact with each other.
8
8
Common Language Specifications
• A set of base rules to which any language targeting the CLI should
conform in order to interoperate with other CLS-compliant languages.
• The CLS rules define a subset of the Common Type System.
• The Common Language Infrastructure (CLI) is an open specification
developed by Microsoft that describes the executable code and
runtime environment that form the core of the Microsoft .NET
Framework.
• The specification defines an environment that allows multiple high-
level languages to be used on different computer platforms without
being rewritten for specific architectures.
9
9
Common Language Runtime
The Common Language Runtime (CLR) is a core component of
Microsoft’s .NET initiative. It is Microsoft's implementation of the
Common Language Infrastructure (CLI) standard, which defines an
execution environment for program code. In the CLR, code is
expressed in a form of byte code called the Common
Intermediate Language (CIL, previously known as MSIL—
Microsoft Intermediate Language).
Developers using the CLR write code in a language such as C# or
VB.NET. At compile time, a .NET compiler converts such code into
CIL code. At runtime, the CLR's just in time compiler converts the
CIL code into code native to the operating system.
10
.NET Framework Execution Model
Step 1 : Source code goes as input to compiler
Step 2: Compiler produce MSIL Code( Microsoft Intermediate Language Code)
Step 3: MSIL Code is executed on CLR which is a managed environment.
Step 4: CLR creates the equivalent native code of MSIL that runs on the actual hardware.
11
Memory Management
Common language runtime provides the automatic memory
management. This feature is available during Managed Execution.
The garbage collector manages the allocation and release of
memory for an application.
Developers need not write code to perform memory
management tasks when they develop managed applications.
Automatic memory management takes care of problems such a
memory leak, or attempting to access memory for an object that
has already been freed.
12
Intermediate Language (IL)
• .NET languages are not compiled to machine code. They
are compiled to an Intermediate Language (IL).
• CLR accepts the IL code and recompiles it to machine
code. The recompilation is just-in-time (JIT) meaning it
is done as soon as a function or subroutine is called.
• The JIT code stays in memory for subsequent calls. In
cases where there is not enough memory it is discarded
thus making JIT process interpretive.
13
Common Language Runtime (CLR)
• Why two compilations?
– Platform independence
• .NET Framework can be installed on different platforms
• Execute .NET programs without any modifications to code
• .NET compliant program translated into platform independent MSIL
– Language independence
• MSIL form of .NET programs not tied to particular language
• Programs may consist of several .NET-compliant languages
• Old and new components can be integrated
• MSIL translated into platform-specific code
• Other advantages of CLR
– Execution-management features
• Manages memory, security and other features
– Relieves programmer of many responsibilities
– More concentration on program logic
14
Managed Vs Unmanaged Code
• Any code that gets converted into MSIL is called Managed Code.
– Managed code lives in CLR, making it easier for CLR to control the
execution of the code.
• Any code that does not converted into MSIL is called Unmanaged Code.
– Unmanaged code directly interacts with the underlying Operating system.
15
Assemblies
• “An assembly provides a fundamental unit of physical code grouping”
• An assembly is a collection of Types and Resources that forms a logical unit of
functionality.
• All types in the .NET Framework must exist in assemblies; the common
language runtime does not support types outside of assemblies.
• An Assembly is a compiled code library used for deployment, versioning, and
security. There are two types:
– Process assemblies (EXE)
– Library assemblies (DLL).
• The Assembly is compiled into PE format (Portable Executable) which helps the
OS to load and execute the assembly.
16
Assemblies
• The .NET Framework uses assemblies as the fundamental unit for
several purposes:
– Security
– Type Identity
– Reference Scope
– Versioning
– Deployment
• Every assembly contains a manifest - a set of metadata
(information about the assembly) viz.,
– The assembly name and version
– The culture or language the assembly (not required for all assemblies)
– The public key for any strong name (not required in all assemblies)
– A list of files in the assembly with hash information
– Information on exported types
– Information on referenced assemblies
17
Assemblies
Managed Code
Managed Code
ManagedCode
Managed Code
Assembly
Assembly
Manifest
Manifest
.html
.gif
Produce an Assembly
Are Compiled to
Resource Files
Resource Files Code fles and
Multiple Managed
18
Runtime Host
• A runtime host manages the execution of application code and provides
various services to the application.
• The runtime host loads the
– CLR into a Process – (Process is an execution environment)
– Creates the application domains within the process
– Loads user code into the application domains
• The CLR supports different types of applications such as Windows applications,
Web applications, Mobile applications, etc which requires different type of
hosts.
• Following are examples of some runtime hosts:
– ASP.NET
– Shell Executables
– Microsoft Internet Explorer
19
App Domains
• An application domain is similar to a process in an operating
system that is used to isolate applications from one another so
that they do not affect each other.
• Each application domain is assigned a virtual address space which
scopes the resources for the application domain using it.
• Common language runtime uses application domains to provide
isolation between applications as it provides more secure and
versatile unit of processing.
• Application domains are typically created by runtime hosts, which
are responsible for bootstrapping the common language runtime
before an application is run.
20
App domains
• A process can have 1 or more App domains
• App domain isolates the domain it contains
• App domain provides a consistent environment on
multiple platform
• App domain provides the benefits of process with out
much overhead.
21
Lend a Hand
Sam, can you explain what is the
functionality of a CLR?
Yes, I think I can.
22
Lend a Hand
And, can you explain the
concept of Assemblies?
Of course, and
so can our
learners?
23
Questions
24
Check Your Understanding
25
Summary
• The key points covered in this chapter are:
– .Net Framework: A common environment for building,
deploying, and running Web Services and Web
Applications.
– Common Language Runtime (CLR): It provides a
common runtime for all .NET languages.
– Common Type System (CTS): It defines how types are
declared, used, and managed in the runtime.
– Common Language System (CLS): It specifies the
interoperability or the ability to exchange and use
information between .NET languages.
– Application Domain: It is a logical and physical
boundary created around every .NET application by
CLR.
– Memory Management: .Net memory management is
done by Garbage Collector. It helps to free the memory
when it is no longer used by the application.
26
Source
– www.msdn.microsoft.com
Disclaimer: Parts of the content of this course is based on the materials available from the Web sites and books
listed above. The materials that can be accessed from linked sites are not maintained by Cognizant Academy and
we are not responsible for the contents thereof. All trademarks, service marks, and trade names in this course are
the marks of the respective owner(s).
27
Change Log
Version Changes made
Number
V1.0 Initial Version
V1.1 Slide No.
Changed By Effective Date Changes
Effected
28
Introduction to Evaluation and
Overview of Dot Net
Framework
You have successfully completed -
Overview of Dot Net Framework