Wednesday, 11 July 2012

.NET Framework 3.5 Architecture


The architecture of the .NET Framework version 3.5 and 3.5 Service Pack 1 (SP1) builds upon the earlier versions of the .NET Framework.

.NET Framework Versions

The following table lists the versions of the .NET Framework that are included in the .NET Framework 3.5 and 3.5 SP1. There is no need to install any of the previous service packs if you installed the .NET Framework 3.5 or 3.5 SP1 because they are already included.
.NET Framework version
Features and notes
.NET Framework 3.5 SP1
Updates several assemblies that were included in the .NET Framework 3.5. The updates include non-breaking changes, new API elements, and additional functionality for the technologies that were included in the .NET Framework 3.5. The following technologies are included in the .NET Framework 3.5 SP1:
  • ASP.NET Dynamic Data.
  • ADO.NET Entity Framework.
  • Data provider support for SQL Server 2008.
  • Support for the .NET Framework Client Profile, a setup package that includes only assemblies used by client applications.
.NET Framework 2.0 SP2 and 3.0 SP2
These service packs are available only by installing the .NET Framework 3.5 SP1. They provide additional functionality for future infrastructure. They are not available as a separate install.
Correction: Previously, this topic incorrectly stated that they were available as separate downloads.
.NET Framework 3.5
Provides the first additions to the base class libraries to the .NET Framework since version 2.0. The following technologies are introduced in the .NET Framework 3.5:
  • Language Integrated Query (LINQ).
  • New compilers for C#, Visual Basic, and C++.
  • ASP.NET AJAX.
For a complete list of features, see What's New in the .NET Framework Version 3.5.
.NET Framework 3.0 SP1
Updates .NET Framework 3.0 assemblies
.NET Framework 3.0
The .NET Framework 3.0 requires the .NET Framework 2.0 to be installed on the computer. If a user installs the .NET Framework 3.0 on a computer that does not have the .NET Framework 2.0 installed, the .NET Framework 2.0 is installed automatically.
The following technologies are introduced in the .NET Framework 3.0:
  • Windows Presentation Foundation (WPF).
  • Windows Communications Foundation (WCF).
  • Windows Workflow Foundation (WF).
.NET Framework 2.0 SP1
Updates .NET Framework 2.0 assemblies
.NET Framework 2.0
Provides the core architectural base for all subsequent versions of the Framework. The following technologies are included in the .NET Framework 2.0:
  • Common language runtime (CLR) and base class libraries.
  • Support for generic types and methods.
  • Compilers for C#, Visual Basic, C++, and J#.
  • ADO.NET.
  • ASP.NET.
  • Windows Forms.
  • Web services.
This is the last version of the Framework that supports side-by-side operations of the .NET Framework versions 1.0 through 2.0.

Memory Management in .NET Framework


 This article features a review discussing the function of memory management in Microsoft .NET framework in detail.
 Microsoft .NET framework memory management is taken care of by the Common Language Runtime, CLR system. It is a great feature as it takes care of memory management in Microsoft Dot Net framework and relieves the programmers from the duty of memory management which includes allocating and freeing up the memory.  Thus, we see that memory is allocated to the instantiations of .NET objects in a close manner from the managed heap, a pool of memory managed by the CLR.
 Till the time there is a reference to an object, either a direct reference to an object or through a graph of objects, it is believed to be in use by the Common Language R. When there is no reference to an object, and it cannot be reached or used, it becomes garbage. However, it still holds on to the memory allocated to it. Note that the Microsoft .NET framework memory management system consists of a garbage collector that runs on periodical basis on a different thread from the application's thread, which specifies all the unusable objects and get back the memory allocated to them.
 Garbage Collector (GC) in Microsoft .NET framework can be defined as a non-deterministic, compacting, mark-and-sweep garbage collector. It is in running state only when a definite amount of memory has already been used or the system is under pressure for memory. The Garbage Collector which is used for memory management in Microsoft .NET framework is actually a generational one. The objects are being assigned a generation and the newly formed objects come under Generation 0. The objects which successfully overcome garbage collection are named as Generation 1, and those objects of Generation 1 that successfully survive another Garbage collection are known as Generation 2 objects.
 The Microsoft .NET framework utilizes objects till the Generation 2 objects and the objects belonging to the higher generation objects are garbage collected less frequently as compared to the objects belonging to lower generations. It helps in enhancing the efficiency of garbage collection, as older objects are more likely to have a superior lifetime than the newer objects. Therefore by removing the older objects from the scope of a collection run, there would be lesser number of objects which required checking and compacting in process of memory management in Microsoft Dot Net framework.

.NET Framework is


A programming infrastructure created by Microsoft for building, deploying, and running applications and services that use .NET technologies, such as desktop applications and Web services. The .NET Framework contains three major parts:
1.       Common Language Runtime
2.       Framework Class Library
3.       ASP.NET.

CLR (Common Language Runtime)

A runtime environment that manages the execution of .NET program code and provides services such as memory and exception management, debugging and profiling, and security. The CLR is a major component of the .NET framework. CLR also is known as the Virtual Execution System (VES).

FCL (Framework class library)

The collective name for the thousands of classes that compose the .NET Framework. The services provided by the FCL include runtime core functionality (basic types and collections, file and network I/O, accessing system services, etc.), interaction with databases, consuming and producing XML, and support for building Web-based and desktop-based client applications, and SOAP-based XML Web services.

ASP.NET

A Microsoft server-side Web technology. ASP.NET takes an object-oriented programming approach to Web page execution. Every element in an ASP.NET page is treated as an object and run on the server. An ASP.NET page gets compiled into an intermediate language by a .NET Common Language Runtime-compliant compiler. Then a JIT compiler turns the intermediate code to native machine code, and that machine code is eventually run on the processor. Because the code is run straight from the processor, pages load much faster than classic ASP pages, where embedded VBScript or JavaScript had to be continuously interpreted and cached.  ASP.NET is used to create Web pages and Web services and is an integral part of Microsoft's .NET vision.

Features Included in the .NET Framework Versions

Each new version of the .NET Framework retains features from the previous versions and adds new features. Although the CLR is the core component of the .NET Framework, the CLR is identified by its own version number apart from the .NET Framework version number. Some versions of the .NET Framework include a new version of the CLR, but others use an earlier version. For example, the .NET Framework version 4 includes CLR version 4, but the .NET Framework 3.5 includes CLR 2.0. (There was no version 3 of the CLR.) The version of the CLR on which an application is running can be determined by retrieving the value of the Environment version property.
You do not have to install previous versions of the .NET Framework or the CLR before you install the latest version; each version provides the necessary components.
The following table provides a brief review of the .NET Framework versions and the associated CLR version. It also shows the Visual Studio version that provided the development environment when that version of the .NET Framework was introduced. However, with the multi-targeting feature of Visual Studio, you are not limited to only that version of the .NET Framework.
.NET Framework version
CLR version
Visual Studio version
Description
1.0
1.0
Visual Studio .NET
Contained the first version of the CLR and the first version of the base class libraries.
1.1
1.1
Visual Studio .NET 2003
Included updates to ASP.NET and ADO.NET. This version was subsequently updated twice, with Service Pack 1 (SP1) and SP2. This version also introduced side-by-side execution, which enables applications on a single computer to run against multiple versions of the CLR.
2.0
2.0
Visual Studio 2005
Introduced a new version of the CLR with additions to the base class libraries, including generics, generic collections, and significant additions to ASP.NET. This version was subsequently updated with SP1 and SP2.
3.0
2.0
Visual Studio 2005
This version is essentially .NET Framework 2.0 with the addition of Windows Presentation Foundation (WPF), Windows Communications Foundation (WCF), Windows Workflow Foundation (WF), and CardSpace. It was subsequently updated with SP1 and SP2.
3.5
2.0
Visual Studio 2008
Added new features such as AJAX-enabled Web sites and LINQ. The SP1 update added the .NET Framework Client Profile, Dynamic Data, and a small set of additional enhancements.
4
4
Visual Studio 2010
Includes a new version of the CLR, expanded base class libraries, and new features such as the Managed Extensibility Framework (MEF), dynamic language runtime (DLR), and code contracts.

Windows Installations of the .NET Framework

Some versions of the .NET Framework are installed automatically with the Windows operating system, but other versions must be installed separately. The following table identifies the .NET Framework versions and whether they are integrated into the installation of Windows or must be installed separately.
.NET Framework versions
Windows versions
1.0, 1.1, and 2.0
Not installed as part of the Windows operating system, but can be installed separately on Windows XP and earlier versions of Windows.
3.0 (and 2.0 SP2, which provides support for versions 3.0 and 3.5)
Installed by Windows Vista and Windows Server 2008.
3.5 SP1
Installed by Windows 7.
4
Not installed as part of the Windows operating system, but can be installed separately on Windows XP, Windows Server 2003, and later versions of Windows.

Friday, 29 June 2012

Questions normally asked in .NET Framework Interviews

What is the Microsoft.NET?
.NET is a set of technologies designed to transform the internet into a full scale distributed platform. It provides new ways of connecting systems, information and devices through a collection of web services. It also provides a language independent, consistent programming model across all tiers of an application.
The goal of the .NET platform is to simplify web development by providing all of the tools and technologies that one needs to build distributed web applications.
What is the .NET Framework?
The .NET Framework is set of technologies that form an integral part of the .NET Platform. It is Microsoft's managed code programming model for building applications that have visually stunning user experiences, seamless and secure communication, and the ability to model a range of business processes.
The .NET Framework has two main components: the common language runtime (CLR) and .NET Framework class library. The CLR is the foundation of the .NET framework and provides a common set of services for projects that act as building blocks to build up applications across all tiers. It simplifies development and provides a robust and simplified environment which provides common services to build application. The .NET framework class library is a collection of reusable types and exposes features of the runtime. It contains of a set of classes that is used to access common functionality.

What is CLR?
The .NET Framework provides a runtime environment called the Common Language Runtime or CLR. The CLR can be compared to the Java Virtual Machine or JVM in Java. CLR handles the execution of code and provides useful services for the implementation of the program. In addition to executing code, CLR provides services such as memory management, thread management, security management, code verification, compilation, and other system services. It enforces rules that in turn provide a robust and secure execution environment for .NET applications.
What is CTS?
Common Type System (CTS) describes the data types that can be used by managed code. CTS defines how these types are declared, used and managed in the runtime. It facilitates cross-language integration, type safety, and high performance code execution. The rules defined in CTS can be used to define your own classes and values.
What is CLS?
Common Language Specification (CLS) defines the rules and standards to which languages must adhere to in order to be compatible with other .NET languages. This enables C# developers to inherit from classes defined in VB.NET or other .NET compatible languages.
What is managed code?
The .NET Framework provides a run-time environment called the Common Language Runtime, which manages the execution of code and provides services that make the development process easier. Compilers and tools expose the runtime's functionality and enable you to write code that benefits from this managed execution environment. The code that runs within the common language runtime is called managed code.
What is MSIL?
When the code is compiled, the compiler translates your code into Microsoft intermediate language (MSIL). The common language runtime includes a JIT compiler for converting this MSIL then to native code.
MSIL contains metadata that is the key to cross language interoperability. Since this metadata is standardized across all .NET languages, a program written in one language can understand the metadata and execute code, written in a different language. MSIL includes instructions for loading, storing, initializing, and calling methods on objects, as well as instructions for arithmetic and logical operations, control flow, direct memory access, exception handling, and other operations.
What is JIT?
JIT is a compiler that converts MSIL to native code. The native code consists of hardware specific instructions that can be executed by the CPU.
Rather than converting the entire MSIL (in a portable executable[PE]file) to native code, the JIT converts the MSIL as it is needed during execution. This converted native code is stored so that it is accessible for subsequent calls.
What is portable executable (PE)?
PE is the file format defining the structure that all executable files (EXE) and Dynamic Link Libraries (DLL) must use to allow them to be loaded and executed by Windows. PE is derived from the Microsoft Common Object File Format (COFF). The EXE and DLL files created using the .NET Framework obey the PE/COFF formats and also add additional header and data sections to the files that are only used by the CLR.
What is an application domain?
Application domain is the boundary within which an application runs. A process can contain multiple application domains. Application domains provide an isolated environment to applications that is similar to the isolation provided by processes. An application running inside one application domain cannot directly access the code running inside another application domain. To access the code running in another application domain, an application needs to use a proxy.
How does an AppDomain get created?
AppDomains are usually created by hosts. Examples of hosts are the Windows Shell, ASP.NET and IE. When you run a .NET application from the command-line, the host is the Shell. The Shell creates a new AppDomain for every application. AppDomains can also be explicitly created by .NET applications.
What is an assembly?
An assembly is a collection of one or more .exe or dll’s. An assembly is the fundamental unit for application development and deployment in the .NET Framework. An assembly contains a collection of types and resources that are built to work together and form a logical unit of functionality. An assembly provides the CLR with the information it needs to be aware of type implementations.
What are the contents of assembly?
A static assembly can consist of four elements:
·         Assembly manifest - Contains the assembly metadata. An assembly manifest contains the information about the identity and version of the assembly. It also contains the information required to resolve references to types and resources.
·         Type metadata - Binary information that describes a program.
·         Microsoft intermediate language (MSIL) code.
·         A set of resources.
What are the different types of assembly?
Assemblies can also be private or shared. A private assembly is installed in the installation directory of an application and is accessible to that application only. On the other hand, a shared assembly is shared by multiple applications. A shared assembly has a strong name and is installed in the GAC.
We also have satellite assemblies that are often used to deploy language-specific resources for an application.
What is a dynamic assembly?
A dynamic assembly is created dynamically at run time when an application requires the types within these assemblies.
What is a strong name?
You need to assign a strong name to an assembly to place it in the GAC and make it globally accessible. A strong name consists of a name that consists of an assembly's identity (text name, version number, and culture information), a public key and a digital signature generated over the assembly.  The .NET Framework provides a tool called the Strong Name Tool (Sn.exe), which allows verification and key pair and signature generation.
What is GAC? What are the steps to create an assembly and add it to the GAC?
The global assembly cache (GAC) is a machine-wide code cache that stores assemblies specifically designated to be shared by several applications on the computer. You should share assemblies by installing them into the global assembly cache only when you need to.
- recompile project, and then install it to GAC in two ways : 
·         drag & drop it to assembly folder (C:\WINDOWS\assembly OR C:\WINNT\assembly) (shfusion.dll tool)
·         gacutil -i abc.dll
What is the caspol.exe tool used for?
The caspol tool grants and modifies permissions to code groups at the user policy, machine policy, and enterprise policy levels.
What is a garbage collector?
A garbage collector performs periodic checks on the managed heap to identify objects that are no longer required by the program and removes them from memory.
What are generations and how are they used by the garbage collector?
Generations are the division of objects on the managed heap used by the garbage collector. This mechanism allows the garbage collector to perform highly optimized garbage collection. The unreachable objects are placed in generation 0, the reachable objects are placed in generation 1, and the objects that survive the collection process are promoted to higher generations.
What is Ilasm.exe used for?
Ilasm.exe is a tool that generates PE files from MSIL code. You can run the resulting executable to determine whether the MSIL code performs as expected.
What is Ildasm.exe used for?
Ildasm.exe is a tool that takes a PE file containing the MSIL code as a parameter and creates a text file that contains managed code.
What is new in each versions of .NET?
.NET Framework versionCLR versionVisual Studio versionDescription
1.01.0Visual Studio .NETContained the first version of the CLR and the first version of the base class libraries.
1.11.1Visual Studio .NET 2003Included updates to ASP.NET and ADO.NET. This version was subsequently updated twice, with Service Pack 1 (SP1) and SP2. This version also introduced side-by-side execution, which enables applications on a single computer to run against multiple versions of the CLR.
2.02.0Visual Studio 2005Introduced a new version of the CLR with additions to the base class libraries, including generics, generic collections, and significant additions to ASP.NET. This version was subsequently updated with SP1 and SP2.
ASP.NET
ADO.NET
Windows Form
Web Service
3.02.0Visual Studio 2005This version is essentially .NET Framework 2.0 with the addition of Windows Presentation Foundation (WPF),
Windows Communications Foundation (WCF),
Windows Workflow Foundation (WF), and
Windows Card Space.
It was subsequently updated with SP1 and SP2.
3.52.0Visual Studio 2008Added new features such as
AJAX-enabled Web sites and LINQ.
Add-in extensibility
Garbage collection Latency Mode
Inter-process communication with pipes
Cryptography suite B support
New Compiler for C#, VB and C++
The SP1 update added the .NET Framework Client Profile, Dynamic Data, and a small set of additional enhancements.
Garbage collection notification
Customized branding for click once applications
Expanded ADO.Net platform with new feature of SQL 2008 features.
44Visual Studio 2010Includes a new version of the CLR, expanded base class libraries, and new features such as the Managed Extensibility Framework (MEF), dynamic language runtime (DLR), and code contracts.

.NET 4.0 has no dependency over the previous installations or versions of the .NET Framework. It is designed to run side by side with other versions of .NET Framework on the computer
Improved
·         Security Model
·         Managed Extensibility Framework
·         Parallel computing
·         Application capability & Development
·         Base Class Library
·         Net Working
·         Web
·         Client
·         Data
·         WCF
·         WWF


Google+ Followers