Overview of .NET Framework 4.6

Microsoft released Visual Studio 2015 preview with .Net Framework 4.6 which is compatible with .Net Framework 4 and above. It is a part of windows 10 and can be installed on Windows 7 and Windows 8 as well. Lets have a look into some of the new features added in this version of .NET framework.

Latest Features of the .NET Framework 4.6

Base Class Library(BCL)

Support for code page encodings

Change in Event Tracing

Open-source .NET Framework packages

Resizing Windows Forms forms

.Net Native

1) Base Class Library (BCL)

In Base class library, mainly new APIs are added for cross-platform. In previous version of .Net framework CurrentCulture & CurrentUICulture properties of CultureInfo class were read-only but now they become read-write both.

Now Queue which is in System.Collections.Generic.Queue namespace and Stack which is in System.Collections.Generic.Stack namespace implements ReadOnlyCollection which is in System.Collections.ObjectModel.ReadOnlyCollection.

2) Support for code page encodings

Previously, .Net framework provided support for the unicode encoding and limited support for code page encodings. You had to add the reference of System.Text.Encoding.CodePages.dll assembly to your project. Then Retrieve a CodePagesEncodingProvider object from the static Instance property. Now pass the CodePagesEncodingProvider object to the Encoding.RegisterProvider method.

3) Event Tracing

Now, object of EventSource can be constructed directly so you can call write() method.

4) Open-source .Net Packages

Some of .Net packages are now available on GitHub like, Immutable Collections and SIMD APIs.

5) Resizing Windows Forms form

In .Net framework some new namesapces that are added are,

System.Windows.Forms.DomainUpDown

System.Windows.Forms.DataGridViewComboBoxColumn

System.Windows.Forms.ToolStripSplitButton

System.Windows.Forms.NumericUpDown

System.Windows.Forms.DataGridViewColumn

Only need to EnableWindowsFormsHighDpiAutoResizing property to true in web.config.

6) .Net Native

.Net Native is the pre-compilation technology for building and deploying Windows store apps. It compiles apps that are written in managed code and target to the .Net framework to native code. It is different from Just-In-Time (JIT) and Native Image Generator (NGEN). Bascially this tool chain converts source code to native code at compile time. The compilation of IL code to native code is handled by JIT.

.Net Native tool chain begins execution after the C# compiler has finished Windows Store app’s compilation. This tool compiles an entire application to a native application. It doesn’t allow to compile a single assembly that contains a class library to native code so that it can be called independently from the managed code.

Windows Presentation Foundation (WPF)

1) Transparent child window support

Now you can create the transparent child windows in windows 8.1 and above. To make it enable set UsesPerPixelTransparency property to true.

2) High DPI Improvements

High Direct Programming Interface is now better in WPF. It is enabled if your target framework is 4.6 or above. Multiple monitors with different dpi-settings are now rendered correctly without any issue.

3) Better Touch

Previous touch events’ connect issue has been fixed with this new release.

Windows Communication Foundation

1) SSL

Now, it is possible cfor you to select which protocol to use, or to disable old less secure protocols. It is possible either by setting the System.ServiceModel.TcpTransportSecurity.SslProtocols property or by changing in the following code to app.config file.

2) Send messages

There are two ways to achieve the send messages using different HTTP connections.

Connection Group name prefix: Users are able to specify a string that WCF will use as a prefix for the connection group name. There are two messages having different prefixes which are sent using different underlying HTTP connections. By adding System.ServiceModel.Channels.Message.Properties property of key/value pair message, we can set the prefix where key is HttpTransportConnectionGroupNamePrefix and the value is desired prefix.

Using different channel factories : Users are able to verify messages that are sent using channels of different channel factories that will use different underlying HTTP connections. To make it enable set the following appSetting,

RyuJIT

In .Net, RyuJIT is the next generation Just-In-Time (JIT) compiler. It focused on throughput JIT compilation. In past there was a big gap in throughput between the 32-bit and 64-bit JITs. But now it became easier to particularly target 64-bit architectures or to migrate workloads from 32- to 64-bit.

RyuJIT is enabled for 64-bit processes. It is running on top of the .NET Framework 4.6. If your app is compiled as AnyCPU or 64-bit then it will run in a 64-bit process. RyuJIT is similarly integrated into .NET Core, as the 64-bit JIT.

SIMD

Single Instruction Multiple Data (SIMD) Vectors are introduced by 64-bit CLR. They are in the .System.Numerics namespace. The new types include fixed-size Vectors having 2 to 4 single precision floating point elements with explicit N-dimensional algorithms and data types (e.g. points and colors) which are suitable for use in applications, as well as Vector whose size is target-dependent (e.g. 4 floats on SSE2, 8 on AVX2), which allows applications having larger amount of available data parallelism for scaling the target hardware without rebuilding.