Update [1/12/2016]: This post was updated to add information about reference source for .NET Framework 4.6.1.
Today we are announcing the availability of .NET Framework 4.6.1. You can download this release now.
Here is a summary of key improvements available in .NET Framework 4.6.1:
- WPF improvements for spell check, support for per-user custom dictionaries and improved touch performance
- Enhanced support for Elliptic Curve Digital Signature Algorithm (ECDSA) X509 certificates
- Added support in SQL Connectivity for AlwaysOn, Always Encrypted and improved connection open resiliency when connecting to Azure SQL Database
- Azure SQL Database now supports distributed transactions using the updated System.Transactions APIs
- Many other performance, stability, and reliability related fixes in RyuJIT, GC, WPF and WCF.
The .NET Framework 4.6.1 can be installed on Windows 10, Windows 8.1, Windows 8, Windows 7 and the corresponding server platforms. You can use either the web installer or the offline installer based on your needs.
You can target the .NET Framework 4.6.1 in Visual Studio 2012 or later by installing the .NET Framework 4.6.1 Developer Pack.
You can learn more about this release by reviewing the changes at .NET Framework 4.6.1 release change list, Application Compatibility in the .NET Framework 4.6.1, and .NET Framework API diff (GitHub) between the .NET 4.6.1 and .NET 4.6 releases.
You can now step through .NET 4.6.1 source as part of the debugging experience. Additionally, the reference source for .NET 4.6.1 is available for browsing on the Microsoft Reference Source site as well as GitHub.
Windows Presentation Foundation
The WPF team has made a number of key improvements in this release. For more details on these improvements and more, check out the blog post by the WPF team here.
WPF Touch feature performance has been improved with coalescing support added to touch events such that the current position is reported after a UI thread delay similar to mouse pointer movements. Additionally, you will observe a smoother experience with RichTextBox typing as the Render thread during fast input now no longer consumes as much as CPU cycles as it used to before.
There are a number of WPF Samples on MSDN. We are moving over 200+ of these popular samples (based on usage) into an Open Source GitHub repository. Help us improve our samples by sending us a pull-request or opening a GitHub issue.
We have released a NuGet package that provides new implementations of D3DImage that will make it easy for you to inter-operate with DX 10 and DX 11 content. Support for DX 12 will be added in a future release. The code for this package has been open sourced and is available here.
Spell Checking Improvements
The spell checker in WPF has been updated on Windows 8.1 and above to leverage OS support for spell checking additional languages. There is no change in functionality on Windows 8 and below.
Additional support for per-user custom dictionaries
In .NET 4.6.1 we have added support for WPF to recognize custom dictionaries registered globally. This capability is available in addition to the ability to register them per-control. In addition, custom dictionaries in Windows 10 and Windows 8.1 now have affordances for Excluded Words and AutoCorrect lists.
Support for X509certificates containing ECDSA
We made some major improvements to the System.Security.Cryptography APIs in .NET 4.6 when RSACng support for X509 certificates was added. With .NET 4.6.1 we have extended the cryptographic libraries to enhance support for Elliptic Curve Digital Signature Algorithm (ECDSA) X509 certificates. ECDSA keys are smaller than equivalent-security RSA keys, resulting in better performance in uses such as Transport Layer Security (TLS). The .NET Framework implementation calls into the underlying OS functionality.
Here is an example of how the new approach can be used:
Syntactical specifics for the type ECDsaCetificateExtensions are covered by the MSDN documentation for this type.
Support for Hardware Security Modules
.NET Framework 4.6 introduced support for the Always Encrypted feature by means of which a SQL Server can perform operations on encrypted data, with the safety of encryption key residing with the application inside the customer’s trusted environment. .NET Framework 4.6.1 builds on top of this by storing Always Encrypted column master keys natively in Hardware Security Modules (HSMs).
With this support you can leverage asymmetric keys stored in HSMs without having to write custom column master key store providers and registering them in the applications.
Note: Customers need to install the HSM vendor provided CSP provider or CNG key store providers on the app servers or client computers in order to access Always Encrypted data protected with column master keys stored in a HSM. Details on setting up HSMs and implementing an application that leverages HSM protected column master key to access data in protected columns is covered here.
Improve MultisubnetFailover connection behavior for AlwaysOn
The SqlClient now automatically provides faster connection to AlwaysOn Availability Group that was introduced in SQL Server 2012. It transparently detects whether your application is connecting to an AlwaysOn availability group (AG) on different subnet and quickly discovers the current active server and provides connection to the server.
Prior to this release, an application has to set connection string to include “MultisubnetFailover=true” to indicate that it is connecting to AlwaysOn Availability Group. Without turning on the connection keyword, an application might experience a timeout while connecting to AlwaysOn Availability Group.
With this feature an application does not need to set MultisubnetFailover to true anymore. For more information about SqlClient support for AlwaysOn Availability Groups, see SqlClient Support for High Availability, Disaster Recovery.
Improve connection open resiliency when connecting to Azure SQL Database
With ADO.NET 4.6.1, reliability of opening connections to Azure SQL Database using SqlConnection.Open has been improved. SqlClient’s Connection Open logic now incorporates best effort retry mechanisms on transient faults for certain errors within the Connection Timeout period. Interval between retries and total retry attempts are configurable. ConnectionString keywords ConnectRetryInterval and ConnectRetryCount are used for this purpose, in addition to its use in Idle Connection Resiliency scenario. This feature will improve application availability when connecting to Azure SQL Database even when no additional retry logic is added to the application. However, for added resiliency to transient faults, we recommend incorporating additional application level retry logic.
Distributed transactions with non-MSDTC coordinators
Users of the Transaction.EnlistPromotableSinglePhase method can now utilize a different distributed transaction manager other than MSDTC to promote the transaction. This is accomplished by specifying a GUID transaction promoter identifier to a new variation of the Transaction.EnlistPromotableSinglePhase method. It this operation is successful, there are limitations placed on the capabilities of the Transaction.
Once a non-MSDTC transaction promoter is enlisted, the following methods will throw a TransactionPromotionException because these methods would require promotion to MSDTC by System.Transactions:
Serialization of a Transaction object
Once a non-MSDTC transaction promoter is enlisted, future durable enlistments must be made with that transaction promoter using protocols defined by that transaction promoter. The Guid of the transaction promoter can be obtained using the Transaction.PromoterId property. When the transaction promotes, the transaction promoter provides a byte referred to as the promoted token. An application can obtain the promoted token for a non-MSDTC promoted transaction with the Transaction.GetPromotedToken method.
Users of this new variation of the Transaction.EnlistPromotableSinglePhase method must follow a specific call sequence in order for the promotion operation to complete successfully. These rules are documented in the MSDN description of the new method.
You can view a code sample here.
Distributed Transactions with Azure SQL database
Distributed transactions ensure that changes to different databases happen either in all of the databases or none. This enables the familiar atomicity and isolation properties that ensure that state across databases remains consistent. For instance, this is important when processing financial transactions across databases, or when updating inventory in one database and orders in another.
Azure SQL Database now supports the System.Transaction APIs using a non-MSDTC coordinator as discussed in the previous section. Since MSDTC is not available for Platform-as-a-Service offerings in Azure, Azure SQL Database uses its own distributed transaction manager that does not depend on MSDTC. The enhanced capabilities in .NET 4.6.1 for transaction coordination without MSDTC allow Azure SQL Databases to support distributed transactions through the familiar System.Transaction APIs. This makes it very easy for developers to migrate existing database applications using MSDTC to Azure.
In most cases, existing code using the System.Transaction APIs will now work against Azure SQL Database without any code changes when using .NET 4.6.1. The following code sample illustrates the familiar .NET coding paradigm for distributed transaction coordination using System.TransactionScope which is now also supported for Azure SQL Database:
To learn more about distributed transaction support for Azure SQL Database, please refer to the documentation for elastic database transactions.
Profiling and Ngen
Better support for accessing PDBs in the IcorProfilerInfo Interface
With ASP.NET 5, it is much more common for assemblies to be compiled in-memory by Roslyn. For developers making profiling tools, this means that PDBs which historically were serialized on disk may no longer be present. Profiler tools often used PDBs to map code back to source lines for tasks such as code coverage or line by line performance analysis.
In order to provide these profiler tools with access to the in-memory PDB data we have added additional functionality to the ICorProfiler set of APIs. Using the new APIs, a profiler can obtain the contents of an in-memory PDB as a byte array, and then process it or serialize it to disk.
Better instrumentation with ICorProfiler
We have improvements for profilers that are using ICorProfiler API’s ReJIT functionality for dynamic instrumentation. Previously such tools could instrument IL at any time, but metadata could only be modified at module load time. Because IL refers to metadata, this limited the kinds of instrumentation that could be done.
We have lifted some of those limits by supporting a sub-set of metadata edits after the module loads, in particular adding new AssemblyRef, TypeRef, TypeSpec, MemberRef, MemberSpec, and UserString records. With these changes a much broader range of on-the-fly instrumentation is possible for better production diagnostics. This gives the ability to change the code of a process without recompiling that is already running, which is a requirement for production diagnostics.
You can learn about the API change using the following MSDN link:
Native Image Generator (NGEN) PDBs
Cross-machine event tracing allows developers to profile a program on Machine A and look at the profiling data with source line mapping on Machine B. With the new Ngen PDBs feature we have made the cross-machine event tracing much easier.
When developers need to get source line information while profiling the NI image generated on a user machine or host machine, they can encounter issues like access problem that requires them to first copy all the related assemblies from the user or host machine to a machine that has the IL PDB access. However, with the Ngen PDBs feature, Ngen can now create a PDB that contains the IL to native mapping without a dependency on the IL PDB. In cross-machine event tracing scenario, all that is needed is to copy the native image PDB, which is generated by Machine A, to Machine B, use DIA APIs to read IL PDB’s source to IL mapping and the native image PDB’s IL to native mapping. Combining both mappings provides a source to native mapping. Since the native image PDB will be much smaller than all the modules and native images, the copy process from Machine A to Machine B will be much faster.
Using previous versions of the .NET Framework the user would have to copy all the modules and native images from the profiled machine to the analysis machine which contains the IL PDB to create the source to native mapping. While this process may work well for phone applications where the files are relatively small, the files can be very large on Desktop systems and will take significant time to copy.
.NET Framework 4.6 introduced support to the Token Binding protocol and enabled this for ASP.NET. Token Binding is a new protocol on the standards track in IETF (Internet Engineering Task Force) that solves the issue of browser cookies being usable as bearer tokens, i.e., cookies can be taken off of one machine and used to act as the user by malicious code anywhere else.
It achieves this by binding the tokens to the client machine using a private key accessible only to it. In .NET Framework 4.6.1, we have added support to the HttpListener API to enable server applications to use token binding.
Sample code illustrating an implementation of this feature is as follows.
Today’s releases of .NET Framework 4.6.1 and Visual Studio 2015 Update 1 provides significant improvements to your development experience as well as greater the reliability and performance of apps. A huge thank you to everyone who provided feedback to shape these releases so far. Please install the latest bits and let us know your feedback. We very much appreciate it.
You can send us your feedback from within Visual Studio directly using the Send-a-Smile functionality or alternatively file a bug using Microsoft Connect. If you have a suggestion for a great new feature you’d like to see in a future release, please let us know by adding your idea under the .NET category on the Visual Studio User Voice site.