.NET Framework

From Infogalactic: the planetary knowledge core
Jump to: navigation, search

<templatestyles src="Module:Hatnote/styles.css"></templatestyles>

.NET Framework
Microsoft .NET Framework v4.5 logo.png
DotNet.svg
.NET Framework component stack
Developer(s) Microsoft
Initial release 13 February 2002; 22 years ago (2002-02-13)
Stable release 4.6.1 / 17 November 2015; 8 years ago (2015-11-17)[1]
Operating system Windows 98 or later, Windows NT 4.0 or later
Type Software framework
License Mixed; see § Licensing
Website microsoft.com/net

.NET Framework (pronounced dot net) is a software framework developed by Microsoft that runs primarily on Microsoft Windows. It includes a large class library known as Framework Class Library (FCL) and provides language interoperability (each language can use code written in other languages) across several programming languages. Programs written for .NET Framework execute in a software environment (as contrasted to hardware environment), known as Common Language Runtime (CLR), an application virtual machine that provides services such as security, memory management, and exception handling. FCL and CLR together constitute .NET Framework.

FCL provides user interface, data access, database connectivity, cryptography, web application development, numeric algorithms, and network communications. Programmers produce software by combining their own source code with .NET Framework and other libraries. .NET Framework is intended to be used by most new applications created for the Windows platform. Microsoft also produces an integrated development environment largely for .NET software called Visual Studio.

.NET Framework started out as a proprietary framework, although the company worked to standardize the software stack almost immediately, even before its first release. Despite the standardization efforts, developers—particularly those in the free and open-source software communities—expressed their uneasiness with the selected terms and the prospects of any free and open-source implementation, especially with regard to software patents. Since then, Microsoft has changed .NET development to more closely follow a contemporary model of a community-developed software project, including issuing an update to its patent that promises to address the concerns.

.NET Framework family also includes two versions for mobile or embedded device use. A reduced version of the framework, .NET Compact Framework, is available on Windows CE platforms, including Windows Mobile devices such as smartphones. Additionally, .NET Micro Framework is targeted at severely resource-constrained devices.

History

<templatestyles src="Module:Hatnote/styles.css"></templatestyles>

Microsoft started development of .NET Framework in the late 1990s, originally under the name of Next Generation Windows Services (NGWS). By late 2000, the first beta versions of .NET 1.0 were released.

In August 2000, Microsoft, Hewlett-Packard, and Intel worked to standardize Common Language Infrastructure (CLI) and C#. By December 2001, both were ratified ECMA standards.[2][3] ISO followed in April 2003. The current version of ISO standards are ISO/IEC 23271:2012 and ISO/IEC 23270:2006.[4][5]

While Microsoft and their partners hold patents for CLI and C#, ECMA and ISO require that all patents essential to implementation be made available under "reasonable and non-discriminatory terms". In addition to meeting these terms, the companies have agreed to make the patents available royalty-free. However, this did not apply for the part of .NET Framework not covered by ECMA/ISO standards, which included Windows Forms, ADO.NET, and ASP.NET. Patents that Microsoft holds in these areas may have deterred non-Microsoft implementations of the full framework.[6]

On 3 October 2007, Microsoft announced that the source code for .NET Framework 3.5 libraries was to become available under the Microsoft Reference License (Ms-RSL[lower-alpha 1]).[7] The source code repository became available online on 16 January 2008 and included BCL, ASP.NET, ADO.NET, Windows Forms, WPF, and XML. Scott Guthrie of Microsoft promised that LINQ, WCF, and WF libraries were being added.[8]

On 12 November 2014, Microsoft announced .NET Core, in an effort to include cross-platform support for .NET, the source release of Microsoft's CoreCLR implementation, source for the "entire [...] library stack" for .NET Core, and the adoption of a conventional ("bazaar"-like) open-source development model under the stewardship of the .NET Foundation. Miguel de Icaza describes .NET Core as a "redesigned version of .NET that is based on the simplified version of the class libraries",[9] and Microsoft's Immo Landwerth explained that .NET Core would be "the foundation of all future .NET platforms". At the time of the announcement, the initial release of the .NET Core project had been seeded with a subset of the libraries' source code and coincided with the relicensing of Microsoft's existing .NET reference source away from the restrictions of the Ms-RSL. Landwerth acknowledged the disadvantages of the previously selected shared source license, explaining that it made codename Rotor "a non-starter" as a community-developed open source project because it did not meet the criteria of an OSI-approved license.[10][11][12]

Microsoft also produced an update to its patent grants, which further extends the scope beyond its previous pledges. Prior projects like Mono existed in a legal grey area because Microsoft's earlier grants applied only to the technology in "covered specifications", including strictly the 4th editions each of ECMA-334 and ECMA-335. The new patent promise, however, places no ceiling on the specification version, and even extends to any .NET runtime technologies documented on MSDN that have not been formally specified by the ECMA group, if a project chooses to implement them. This permits Mono and other projects to maintain feature parity with modern .NET features that have been introduced since the 4th edition was published without being at risk of patent litigation over the implementation of those features. The new grant does maintain the restriction that any implementation must maintain minimum compliance with the mandatory parts of the CLI specification.[13]

Microsoft's press release highlights that the cross-platform commitment now allows for a fully open source, modern server-side .NET stack. However, Microsoft does not plan to release the source for WPF or Windows Forms.[14][15]

Versions

Overview of .NET Framework release history[16][17]
Version
number
CLR
version
Release
date
Development tool Included in Replaces
Windows Windows Server
1.0 1.0 2002-02-13 Visual Studio .NET[18] XP[a] N/A N/A
1.1 1.1 2003-04-24 Visual Studio .NET 2003[18] N/A 2003 1.0[19]
2.0 2.0 2005-11-07 Visual Studio 2005[20] N/A 2003, 2003 R2,[21] 2008 SP2, 2008 R2 SP1 N/A
3.0 2.0 2006-11-06 Expression Blend[22][b] Vista 2008 SP2, 2008 R2 SP1 2.0[16]
3.5 2.0 2007-11-19 Visual Studio 2008[23] 7, 8[c], 8.1[c], 10[c] 2008 R2 SP1 2.0, 3.0[16]
4.0 4 2010-04-12 Visual Studio 2010[24] N/A N/A N/A
4.5 4 2012-08-15 Visual Studio 2012[25] 8 2012 4.0[16]
4.5.1 4 2013-10-17 Visual Studio 2013[26] 8.1 2012 R2 4.0, 4.5[16]
4.5.2 4 2014-05-05 N/A N/A N/A 4.0–4.5.1[16]
4.6 4 2015-07-20 Visual Studio 2015[27] 10 N/A 4.0–4.5.2[16]
4.6.1 4 2015-11-17[28] Visual Studio 2015 Update 1 10 Version 1511 N/A 4.0–4.6[16]

Notes:

a.^ .NET Framework 1.0 is integral OS component of Windows XP Media Center edition or Tablet PC edition. Installation CDs for the Home editions and the Professional editions of Windows XP SP1, SP2 or SP3 comes with .NET Framework installation packages.[17]
b.^ Expression Blend only covers the Windows Presentation Foundation part of .NET Framework 3.0.
c.^ ^ ^ .NET Framework 3.5 is not automatically installed with Windows 8, 8.1 or 10. It must be installed either from a Windows installation media or from the Internet on demand. Control Panel always attempts the latter.[29]

Architecture

Visual overview of the Common Language Infrastructure (CLI)

Common Language Infrastructure

<templatestyles src="Module:Hatnote/styles.css"></templatestyles>

Common Language Infrastructure (CLI) provides a language-neutral platform for application development and execution, including functions for exception handling, garbage collection, security, and interoperability. By implementing the core aspects of .NET Framework within the scope of CLI, this functionality will not be tied to a single language but will be available across the many languages supported by the framework. Microsoft's implementation of CLI is Common Language Runtime (CLR). It serves as the execution engine of .NET Framework. All .NET programs execute under the supervision of CLR, guaranteeing certain properties and behaviors in the areas of memory management, security, and exception handling.

For computer programs to run on CLI, they need to be compiled into Common Intermediate Language (CIL) – as opposed to being compiled into machine code. Upon execution, an architecture-specific just-in-time compiler (JIT) turns the CIL code into machine code. To improve performance, however, .NET Framework comes with Native Image Generator (NGEN), which performs ahead-of-time compilation.

Class library

.NET Framework includes a set of standard class libraries. The class library is organized in a hierarchy of namespaces. Most of the built-in APIs are part of either System.* or Microsoft.* namespaces. These class libraries implement a large number of common functions, such as file reading and writing, graphic rendering, database interaction, and XML document manipulation, among others. .NET class libraries are available for all CLI compliant languages. .NET Framework class library is divided into two parts: Base Class Library (BCL) and Framework Class Library (FCL).

BCL includes a small subset of the entire class library and is the core set of classes that serve as the basic API of CLR.[30] Classes in mscorlib.dll and some classes in System.dll and System.core.dll are part of BCL. BCL classes are available in .NET Framework as well as its alternative implementations including .NET Compact Framework, Microsoft Silverlight, and Mono.

FCL is a superset of BCL and refers to the entire class library that ships with .NET Framework. It includes an expanded set of libraries, including Windows Forms, ADO.NET, ASP.NET, Language Integrated Query (LINQ), Windows Presentation Foundation (WPF), Windows Communication Foundation (WCF), and Workflow Foundation (WF). BCL is much larger in scope than standard libraries for languages like C++, and comparable in scope to standard libraries of Java.

Assemblies

Compiled CIL code is stored in CLI assemblies. As mandated by the specification, assemblies are stored in Portable Executable (PE) file format, common on Windows platform for all DLL and EXE files. Each assembly consists of one or more files, one of which must contain a manifest bearing the metadata for the assembly. The complete name of an assembly (not to be confused with the file name on disk) contains its simple text name, version number, culture, and public key token. Assemblies are considered equivalent if they share the same complete name, excluding the revision of the version number.

A private key can also be used by the creator of the assembly for strong naming. The public key token identifies which private key an assembly is signed with. Only the creator of the keypair (typically .NET developer signing the assembly) can sign assemblies that have the same strong name as a previous version assembly, since the creator is in possession of the private key. Strong naming is required to add assemblies to Global Assembly Cache.

.NET Core

.NET Core is a free and open-source cross platform implementation of the .NET Framework. It consists of CoreCLR a complete cross-platform runtime implementation of CLR, the virtual machine that manages the execution of .NET programs. .Net Core also includes CoreFX, which is a partial fork of BCL and will support ASP.NET.[31] CoreCLR comes with an improved just-in-time compiler, called RyuJIT.[32]

.Net Core runs console and ASP.NET software in Windows, Linux and OS X. It does not implement Windows Forms or WPF which render the standard GUI for desktop software on Windows, as .NET Core is designed to work with Universal Windows Platform instead.[33] .NET Core is also modular, meaning that instead of assemblies, developers deal with packages.[33]

C++/CLI

<templatestyles src="Module:Hatnote/styles.css"></templatestyles>

Microsoft introduced C++/CLI in Visual Studio 2005, which is a language and means of compiling Visual C++ programs to run within the .NET Framework. Certain portions of the C++ program still run within an unmanaged Visual C++ Runtime, while specially modified portions are translated into CIL code and run with the .NET Framework's CLR.

Assemblies compiled using the C++/CLI compiler are known as mixed-mode assemblies, since they contain native and managed code within the same DLL.[34] Such assemblies are also difficult to reverse engineer, since .NET decompilers such as .NET Reflector only reveal the managed code.

Design principles

Interoperability

Because computer systems commonly require interaction between newer and older applications, .NET Framework provides means to access functionality implemented in newer and older programs that execute outside .NET environment. Access to COM components is provided in System.Runtime.InteropServices and System.EnterpriseServices namespaces of the framework. Access to other functionality is achieved using the P/Invoke feature.

Language independence

.NET Framework introduces a Common Type System (CTS) that defines all possible data types and programming constructs supported by CLR and how they may or may not interact with each other conforming to CLI specification. Because of this feature, .NET Framework supports the exchange of types and object instances between libraries and applications written using any conforming .NET language.

Portability

While Microsoft has never implemented the full framework on any system except Microsoft Windows, it has engineered the framework to be platform-agnostic,[35] and cross-platform implementations are available for other operating systems (see Silverlight and § Alternative implementations). Microsoft submitted the specifications for CLI (which includes the core class libraries, CTS, and CIL),[36][37][38] C#,[39] and C++/CLI[40] to both ECMA and ISO, making them available as official standards. This makes it possible for third parties to create compatible implementations of the framework and its languages on other platforms.

Security

.NET Framework has its own security mechanism with two general features: Code Access Security (CAS), and validation and verification. CAS is based on evidence that is associated with a specific assembly. Typically the evidence is the source of the assembly (whether it is installed on the local machine or has been downloaded from the intranet or Internet). CAS uses evidence to determine the permissions granted to the code. Other code can demand that calling code be granted a specified permission. The demand causes CLR to perform a call stack walk: every assembly of each method in the call stack is checked for the required permission; if any assembly is not granted the permission a security exception is thrown.

Managed CIL bytecode is easier to reverse-engineer than native code, unless obfuscated.[41][42] NET decompiler programs enable developers with no reverse-engineering skills to view the source code behind unobfuscated .NET assemblies. In contrast, apps compiled to native machine code are much harder to reverse-engineer, and source code is almost never produced successfully, mainly because of compiler optimizations and lack of reflection.[citation needed] One concern is over possible loss of trade secrets and the bypassing of license control mechanisms. To mitigate this, Microsoft has included Dotfuscator Community Edition with Visual Studio .NET since 2002.[lower-alpha 2] Third-party obfuscation tools are also available from vendors such as vmware, V.i. Labs, Xenocode, and Red Gate Software. Method-level encryption tools for .NET code are available from vendors such as SafeNet.

Memory management

CLR frees the developer from the burden of managing memory (allocating and freeing up when done); it handles memory management itself by detecting when memory can be safely freed. Instantiations of .NET types (objects) are allocated from the managed heap; a pool of memory managed by CLR. As long as there exists a reference to an object, which might be either a direct reference to an object or via a graph of objects, the object is considered to be in use. When there is no reference to an object, and it cannot be reached or used, it becomes garbage, eligible for collection.

.NET Framework includes a garbage collector (GC) which runs periodically, on a separate thread from the application's thread, that enumerates all the unusable objects and reclaims the memory allocated to them. It is a non-deterministic, compacting, mark-and-sweep garbage collector. GC runs only when a certain amount of memory has been used or there is enough pressure for memory on the system. Since it is not guaranteed when the conditions to reclaim memory are reached, GC runs are non-deterministic. Each .NET application has a set of roots, which are pointers to objects on the managed heap (managed objects). These include references to static objects and objects defined as local variables or method parameters currently in scope, as well as objects referred to by CPU registers.[43] When GC runs, it pauses the application and then, for each object referred to in the root, it recursively enumerates all the objects reachable from the root objects and marks them as reachable. It uses CLI metadata and reflection to discover the objects encapsulated by an object, and then recursively walk them. It then enumerates all the objects on the heap (which were initially allocated contiguously) using reflection. All objects not marked as reachable are garbage.[43] This is the mark phase.[44] Since the memory held by garbage is not of any consequence, it is considered free space. However, this leaves chunks of free space between objects which were initially contiguous. The objects are then compacted together to make used memory contiguous again.[43][44] Any reference to an object invalidated by moving the object is updated by GC to reflect the new location.[44] The application is resumed after the garbage collection is over. The latest version of .NET framework uses concurrent garbage collection along with user code, making pauses unnoticeable, because it is done in background.[45]

GC used by .NET Framework is also generational.[46] Objects are assigned a generation; newly created objects belong to Generation 0. The objects that survive a garbage collection are tagged as Generation 1, and the Generation 1 objects that survive another collection are Generation 2 objects. .NET Framework uses up to Generation 2 objects.[46] Higher generation objects are garbage collected less frequently than lower generation objects. This helps increase the efficiency of garbage collection, as older objects tend to have a longer lifetime than newer objects.[46] Thus, by eliminating older (and thus more likely to survive a collection) objects from the scope of a collection run, fewer objects need to be checked and compacted.[46]

Simplified deployment

.NET Framework includes design features and tools which help manage the installation of computer software to ensure that it does not interfere with previously installed software, and that it conforms to security requirements.[citation needed]

Performance

When an application is first launched, the .NET Framework compiles the CIL code into executable code using its just-in-time compiler, and caches the executable program into the .NET Native Image Cache.[47][48] Due to caching, the application launches faster for subsequent launches, although the first launch is usually slower. To increase speed of the first launch, developers may use the Native Image Generator utility to manually compile and cache any .NET application, ahead-of-time.[48]

The garbage collector, which is integrated into the environment, can introduce unanticipated delays of execution over which the developer has little direct control. "In large applications, the number of objects that the garbage collector needs to deal with can become very large, which means it can take a very long time to visit and rearrange all of them."[49]

.NET Framework provides support for calling Streaming SIMD Extensions (SSE) via managed code from April 2014 in Visual Studio 2013 Update 2. However, Mono has provided support for SIMD Extensions as of version 2.2 within the Mono.Simd namespace; before. Mono's lead developer Miguel de Icaza has expressed hope that this SIMD support will be adopted by CLR's ECMA standard.[50] Streaming SIMD Extensions have been available in x86 CPUs since the introduction of the Pentium III. Some other architectures such as ARM and MIPS also have SIMD extensions. In case the CPU lacks support for those extensions, the instructions are simulated in software.[citation needed]

Licensing

Components of .NET Framework are licensed as follows:

Component License
.NET Core
CoreFX and CoreCLR
MIT License[51]
.NET Micro Framework Apache License 2.0[52]
.NET Compiler Platform (codename "Roslyn") Apache License 2.0[53]
ASP.NET Apache License 2.0[54]
ASP.NET Web Stack Apache License 2.0[55]
ASP.NET Ajax Control Toolkit BSD License[56]
ASP.NET SignalR Apache License 2.0[57]
Entity Framework Apache License 2.0[58]
NuGet Apache License 2.0[59]
Reference source code of .NET Framework 4.5 and earlier Microsoft Reference License (Ms-RSL[lower-alpha 1])[7][60]
Reference source code of .NET Framework 4.6 MIT License[61]
.NET Framework redistributable package Proprietary software[62]

Alternative implementations

.NET Framework is the predominant implementation of .NET technologies. Other implementations for parts of the framework exist. Although the runtime engine is described by an ECMA/ISO specification, other implementations of it may be encumbered by patent issues; ISO standards may include the disclaimer, "Attention is drawn to the possibility that some of the elements of this document may be the subject of patent rights. ISO shall not be held responsible for identifying any or all such patent rights."[63] It is more difficult to develop alternatives to FCL, which is not described by an open standard and may be subject to copyright restrictions. Additionally, parts of FCL have Windows-specific functionality and behavior, so implementation on non-Windows platforms can be problematic.

Some alternative implementations of parts of the framework are listed here.

  • .NET Micro Framework is a .NET platform for extremely resource-constrained devices. It includes a small version of CLR and supports development in C# (though some developers were able to use VB.NET,[64] albeit with an amount of hacking, and with limited functionalities) and debugging (in an emulator or on hardware), both using Microsoft Visual Studio. It also features a subset of .NET Framework Class Library (about 70 classes with about 420 methods), a GUI framework loosely based on WPF, and additional libraries specific to embedded applications.
  • Mono is an implementation of CLI and FCL, and provides additional functionality. It is dual-licensed under free software and proprietary software licenses. It includes support for ASP.NET, ADO.NET, and Windows Forms libraries for a wide range of architectures and operating systems. It also includes C# and VB.NET compilers.
  • Portable.NET (part of DotGNU) provides an implementation of CLI, portions of FCL, and a C# compiler. It supports a variety of CPUs and operating systems.
  • Microsoft Shared Source Common Language Infrastructure is a non-free implementation of CLR. However, the last version only runs on Microsoft Windows XP SP2, and has not been updated since 2006, therefore it does not contain all features of version 2.0 of .NET Framework.
  • CrossNet[65] is an implementation of CLI and portions of FCL. It is free software using the open source MIT License.

Notes

  1. 1.0 1.1 The license has previously been abbreviated Ms-RL, but Ms-RL now refers to the Microsoft Reciprocal License.
  2. Dotfuscator Community Edition 4.0

References

  1. Lua error in package.lua at line 80: module 'strict' not found.
  2. Lua error in package.lua at line 80: module 'strict' not found.
  3. Lua error in package.lua at line 80: module 'strict' not found.
  4. Lua error in package.lua at line 80: module 'strict' not found.
  5. Lua error in package.lua at line 80: module 'strict' not found.
  6. Lua error in package.lua at line 80: module 'strict' not found.
  7. 7.0 7.1 Lua error in package.lua at line 80: module 'strict' not found.
  8. Lua error in package.lua at line 80: module 'strict' not found.
  9. Lua error in package.lua at line 80: module 'strict' not found.
  10. Lua error in package.lua at line 80: module 'strict' not found.
  11. Lua error in package.lua at line 80: module 'strict' not found.
  12. Lua error in package.lua at line 80: module 'strict' not found.
  13. Lua error in package.lua at line 80: module 'strict' not found.
  14. Lua error in package.lua at line 80: module 'strict' not found.
  15. Lua error in package.lua at line 80: module 'strict' not found.
  16. 16.0 16.1 16.2 16.3 16.4 16.5 16.6 16.7 Lua error in package.lua at line 80: module 'strict' not found.
  17. 17.0 17.1 Lua error in package.lua at line 80: module 'strict' not found.
  18. 18.0 18.1 Lua error in package.lua at line 80: module 'strict' not found.
  19. Lua error in package.lua at line 80: module 'strict' not found.
  20. Lua error in package.lua at line 80: module 'strict' not found.
  21. Lua error in package.lua at line 80: module 'strict' not found.
  22. Lua error in package.lua at line 80: module 'strict' not found.
  23. Lua error in package.lua at line 80: module 'strict' not found.
  24. Lua error in package.lua at line 80: module 'strict' not found.
  25. Lua error in package.lua at line 80: module 'strict' not found.
  26. Lua error in package.lua at line 80: module 'strict' not found.
  27. Lua error in package.lua at line 80: module 'strict' not found.
  28. Lua error in package.lua at line 80: module 'strict' not found.
  29. Lua error in package.lua at line 80: module 'strict' not found.
  30. Lua error in package.lua at line 80: module 'strict' not found.
  31. Lua error in package.lua at line 80: module 'strict' not found.
  32. Lua error in package.lua at line 80: module 'strict' not found.
  33. 33.0 33.1 Lua error in package.lua at line 80: module 'strict' not found.
  34. Mixed (Native and Managed) Assemblies, MSDN
  35. Lua error in package.lua at line 80: module 'strict' not found.
  36. Lua error in package.lua at line 80: module 'strict' not found.
  37. Lua error in package.lua at line 80: module 'strict' not found.
  38. Lua error in package.lua at line 80: module 'strict' not found.
  39. Lua error in package.lua at line 80: module 'strict' not found.
  40. Lua error in package.lua at line 80: module 'strict' not found.
  41. Lua error in package.lua at line 80: module 'strict' not found.
  42. Gartner, Inc. as reported in "Hype Cycle for Cyberthreats, 2006", September 2006, Neil MacDonald; Amrit Williams, et al.
  43. 43.0 43.1 43.2 Lua error in package.lua at line 80: module 'strict' not found.
  44. 44.0 44.1 44.2 Lua error in package.lua at line 80: module 'strict' not found.
  45. Lua error in package.lua at line 80: module 'strict' not found.
  46. 46.0 46.1 46.2 46.3 Lua error in package.lua at line 80: module 'strict' not found.
  47. Understanding .NET Just-In-Time Compilation, Telerik
  48. 48.0 48.1 Compiling MSIL to Native Code, MSDN, Microsoft
  49. Lua error in package.lua at line 80: module 'strict' not found.
  50. Lua error in package.lua at line 80: module 'strict' not found.
  51. Lua error in package.lua at line 80: module 'strict' not found.
  52. Lua error in package.lua at line 80: module 'strict' not found.
  53. Lua error in package.lua at line 80: module 'strict' not found.
  54. Lua error in package.lua at line 80: module 'strict' not found.
  55. Lua error in package.lua at line 80: module 'strict' not found.
  56. Lua error in package.lua at line 80: module 'strict' not found.
  57. Lua error in package.lua at line 80: module 'strict' not found.
  58. Lua error in package.lua at line 80: module 'strict' not found.
  59. Lua error in package.lua at line 80: module 'strict' not found.
  60. Lua error in package.lua at line 80: module 'strict' not found.
  61. Lua error in package.lua at line 80: module 'strict' not found.
  62. Lua error in package.lua at line 80: module 'strict' not found.
  63. ISO 9001:2008, Foreword
  64. Lua error in package.lua at line 80: module 'strict' not found.
  65. Lua error in package.lua at line 80: module 'strict' not found.

External links