.NET Framework 4
What's New in the .NET Framework Version 4

[This documentation is for preview only, and is subject to change in later releases. Blank topics are included as placeholders.]

This topic contains information about key features and improvements in the .NET Framework version 4 Beta 2. This topic does not provide comprehensive information about all new features and is subject to change. 

The new features and improvements for .NET Framework 4 Beta 2 are described in the following sections:

Application Compatibility and Deployment

The .NET Framework 4 Beta 2 is designed so that applications and components from earlier versions work smoothly, except in a limited number of known cases. If your application or component does not work after .NET Framework 4 Beta 2 is installed, please submit a bug on the Microsoft Connect Web site. You can test compatibility as described in the .NET Framework 4 Application Compatibility topic and learn about new features by using the Visual Studio 2010 and .NET Framework 4 Walkthroughs. For additional information and known migration issues, visit the .NET Framework Compatibility Blog.

The following sections describe deployment improvements.

Client Profile

The .NET Framework 4 Beta 2 Client Profile supports more platforms than in previous versions and provides a fast deployment experience for your Windows Presentation Foundation (WPF), console, or Windows Forms applications. For more information, see .NET Framework Client Profile.

In-Process Side-by-Side Execution

This feature enables an application to load and start multiple versions of the .NET Framework in the same process. For example, you can run applications that load add-ins (or components) that are based on the .NET Framework 2.0 SP1 and add-ins that are based on the .NET Framework 4 Beta 2 in the same process. Older components continue to use the older .NET Framework version, and new components use the new .NET Framework version. For more information, see In-Process Side-by-Side Execution.

Back to top

Parallel Computing

The .NET Framework 4 Beta 2 introduces a new programming model for writing multithreaded and asynchronous code that greatly simplifies the work of application and library developers. The new model enables developers to write efficient, fine-grained, and scalable parallel code in a natural idiom without having to work directly with threads or the thread pool. The new System.Threading.Tasks namespace and other related types support this new model. Parallel LINQ (PLINQ), which is a parallel implementation of LINQ to Objects, enables similar functionality through declarative syntax. For more information, see Parallel Programming in the .NET Framework.

The following synchronization and threading features provide support for parallel computing:

  • The new System.Threading..::.CancellationTokenSource class provides a unified model for cancellation. You can create a cancellation token to pass to any number of operations on multiple threads. By cancelling the token source object, the IsCancellationRequested property on the token is set to true and the token’s wait handle is signaled, at which time any registered actions with the token are invoked. Any object that has a reference to that token can monitor the value of that property and respond as appropriate.

  • The new System.Collections.Concurrent namespace introduces several new thread-safe collection classes that provide lock-free access to items whenever useful, and fine-grained locking when locks are appropriate. The use of these classes in multi-threaded scenarios should improve performance over collection types such as ArrayList and List<(Of <(T>)>).

  • New synchronization primitives in the System.Threading namespace enable fine-grained concurrency and faster performance by avoiding expensive locking mechanisms.

Back to top

Improved Security Model

The .NET Framework 4 Beta 2 provides a new simplified security mode. For more information, see Security Changes in the .NET Framework 4.

Back to top

Core New Features and Improvements

The following sections describe new features and improvements provided by the common language runtime (CLR) and the base class libraries.

Diagnostics and Performance

Earlier versions of the .NET Framework provided no way to determine whether a particular application domain was affecting other application domains, because the operating system APIs and tools, such as the Windows Task Manager, were precise only to the process level. Starting with the .NET Framework 4 Beta 2, you can get processor usage and memory usage estimates per application domain.

You can monitor CPU and memory usage of individual application domains. Application domain resource monitoring is available through the managed and native hosting APIs and event tracing for Windows (ETW). When this feature has been enabled, it collects statistics on all application domains in the process for the life of the process. See the new AppDomain..::.MonitoringIsEnabled property.

You can now access the ETW events for diagnostic purposes to improve performance. For more information, see CLR ETW Events and Logging CLR Events with ETW. Also see Performance Counters and In-Process Side-By-Side Applications.

The System.Runtime.ExceptionServices..::.HandleProcessCorruptedStateExceptionsAttribute attribute enables managed code to handle exceptions that indicate corrupted process state.

Garbage Collection

The .NET Framework 4 Beta 2 provides background garbage collection. This feature replaces concurrent garbage collection in previous versions and provides better performance. For more information, see the entry So, what’s new in the CLR 4.0 GC? in the CLR Garbage Collector blog.

Code Contracts

Code contracts let you specify contractual information that is not represented by a method's or type's signature alone. The new System.Diagnostics.Contracts namespace contains classes that provide a language-neutral way to express coding assumptions in the form of preconditions, postconditions, and object invariants. The contracts improve testing with run-time checking, enable static contract verification, and support documentation generation. For more information, see Code Contracts.

Design-Time-Only Interop Assemblies

You no longer have to ship primary interop assemblies (PIAs) to deploy applications that interoperate with COM objects. In the .NET Framework 4 Beta 2, compilers can embed type information from interop assemblies, selecting only the types that an application (for example, an add-in) actually uses. Type safety is ensured by the common language runtime. See Using COM Types in Managed Code and Walkthrough: Embedding Type Information from Microsoft Office Assemblies (C# and Visual Basic).

Dynamic Language Runtime

The dynamic language runtime (DLR) is a new runtime environment that adds a set of services for dynamic languages to the CLR. The DLR makes it easier to develop dynamic languages to run on the .NET Framework and to add dynamic features to statically typed languages. To support the DLR, the new System.Dynamic namespace is added to the .NET Framework.

The expression trees are extended with new types that represent control flow, for example, System.Linq.Expressions..::.LoopExpression and System.Linq.Expressions..::.TryExpression. These new types are used by the dynamic language runtime (DLR) and not used by LINQ.

In addition, several new classes that support the .NET Framework infrastructure are added to the System.Runtime.CompilerServices namespace. For more information, see Dynamic Language Runtime Overview.

Covariance and Contravariance

Several generic interfaces and delegates now support covariance and contravariance. For more information, see Covariance and Contravariance in Generics.

BigInteger and Complex Numbers

The new System.Numerics..::.BigInteger structure is an arbitrary-precision integer data type that supports all the standard integer operations, including bit manipulation. It can be used from any .NET Framework language. In addition, some of the new .NET Framework languages (such as F# and IronPython) have built-in support for this structure.

The new System.Numerics..::.Complex structure represents a complex number that supports arithmetic and trigonometric operations with complex numbers.

Tuples

The .NET Framework 4 Beta 2 provides the System..::.Tuple class for creating tuple objects that contain structured data. It also provides generic tuple classes that have from one to seven type parameters for representing singletons, pairs, triples, quadruples, and so on. To support tuple objects that have nine or more components, there is a generic tuple class with seven type parameters and an eighth parameter of any tuple type.

File System Enumerations

New file enumeration methods improve the performance of applications that access large file directories or that iterate through the lines in large files. For more information, see How to: Enumerate Directories and Files.

Memory-Mapped Files

The .NET Framework now supports memory-mapped files. You can use memory-mapped files to edit very large files and to create shared memory for interprocess communication.

64-Bit Operating Systems and Processes

You can identify 64-bit operating systems and processes with the Environment..::.Is64BitOperatingSystem and Environment..::.Is64BitProcess properties.

You can specify a 32-bit or 64-bit view of the registry with the Microsoft.Win32..::.RegistryView enumeration when you open base keys.

Other New Features

The following list describes additional new capabilities, improvements, and conveniences. Several of these are based on customer suggestions.

Back to top

Networking

Enhancements have been made that affect how integrated Windows authentication is handled by the System.Net..::.HttpWebRequest, System.Net..::.HttpListener, System.Net.Mail..::.SmtpClient, System.Net.Security..::.SslStream, System.Net.Security..::.NegotiateStream, and related classes in the System.Net and related namespaces. Support was added for extended protection to enhance security. The changes to support extended protection are available only for applications on Windows 7 and Windows Server 2008 R2; they are not available on earlier versions of Windows. For more information, see Integrated Windows Authentication with Extended Protection.

Enhancements have been made that provide support for Network Address Translation (NAT) traversal using IPv6 and Teredo. These enhancements affect classes in the System.Net and related namespaces. For more information, see NAT Traversal using IPv6 and Teredo.

New networking performance counters have been added that provide information on HttpWebRequest objects. For more information, see Networking Performance Counters.

The System.Net..::.HttpWebRequest class now supports AddRange methods that allow large byte range headers (64-bit ranges) to be used. New properties on the System.Net..::.HttpWebRequest class allow an application set many HTTP headers. A Host property can be used to set the Host header value in an HTTP request independent from the request URI.

Enhancements have been made to the System.Net.Mail..::.SmtpClient and related classes to support mail applications that use the Secure Sockets Layer (SSL) to encrypt the connection. Other enhancements to the System.Net.Mail..::.MailMessage class provide better support for mail headers.

Enhancements have been made that affect encryption and add support for a Null cipher in the System.Net and related namespaces. The encryption policy can be specified for a System.Net..::.ServicePointManager class instance using the EncryptionPolicy property. Constructors for the System.Net.Security..::.SslStream class now support specifying the System.Net.Security..::.EncryptionPolicy.

The System.Net..::.NetworkCredential class provides credentials for password-based authentication schemes such as basic, digest, NTLM, and Kerberos authentication. Passwords may now be treated as System.Security..::.SecureString instances rather than System..::.String instances for improved security.

Enhancements have been made to the System..::.Uri and System.Net..::.HttpListener classes to modify how a URI with percent-encoded values is converted and normalized. For more information, see the System.Net.Configuration..::.HttpListenerElement, System.Configuration..::.SchemeSettingElement, System.Configuration..::.SchemeSettingElementCollection, and System.Configuration..::.UriSection classes.

Back to top

Web

The following sections describe new features in ASP.NET core services, Web Forms, Dynamic Data, and Visual Web Developer. For more information, see What's New in ASP.NET 4 Beta 2 and Visual Web Developer.

ASP.NET Core Services and Web Forms

ASP.NET 4 introduces several features that improve core ASP.NET services such as output caching and session-state storage.

Web Forms has been a core feature in ASP.NET since the release of ASP.NET 1.0. Many enhancements have been made in this area for ASP.NET 4, including the following:

Dynamic Data

For ASP.NET 4, Dynamic Data has been enhanced to give you even more power for quickly building data-driven Web sites. This includes the following:

  • Automatic validation that is based on constraints that are defined in the data model.

  • The ability to easily change the markup that is generated for fields in the GridView and DetailsView controls by using field templates that are part of a Dynamic Data project.

Back to top

Client

The following sections describe new features in Windows Presentation Foundation (WPF) and Managed Extensibility Framework (MEF).

Windows Presentation Foundation

In the .NET Framework 4 Beta 2, Windows Presentation Foundation (WPF) contains changes and improvements in many areas, including controls, graphics, and XAML. For more information, see What's New in WPF Version 4.

Managed Extensibility Framework

The Managed Extensibility Framework (MEF) is a new library in the .NET Framework 4 Beta 2 that helps you build extensible and composable applications. MEF enables you to specify points where an application can be extended, to expose services to offer to other extensible applications and to create parts for consumption by extensible applications. It also enables easy discoverability of available parts based on metadata, without the need to load the assemblies for the parts. For more information, see Managed Extensibility Framework. For a list of the MEF types, see the System.ComponentModel.Composition namespace.

Back to top

Data

ADO.NET provides new features for the Entity Framework, including Persistence-Ignorant Objects, functions in LINQ queries, and Customized Object Layer Code Generation. For more information, see What's New in ADO.NET.

Back to top

Communications and Workflow

Windows Communication Foundation (WCF) provides messaging enhancements and seamless integration with Windows Workflow Foundation (WF). WF provides improvements in performance, scalability, workflow modeling, and an updated visual designer. For more information, see What's New in Windows Communication Foundation and What's New in Windows Workflow Foundation.

Back to top

See Also

Concepts

Other Resources

Page view tracker