Today I am writing about new features implemented on the recently released .NET Framework 4.7.1. On October 17, 2017 Microsoft has announced the release of .NET Framework 4.7.1. It’s included in the Windows 10 Fall Creators Update. .NET Framework 4.7.1 is also available on Windows 7+ and Windows Server 2008 R2+. Microsoft has added support for targeting the .NET Framework 4.7.1 in Visual Studio 2017 15.5.
The .NET Framework 4.7.1 includes improvements in several areas:
- Accessibility improvements in narration, high contrast and focus control areas
- .NET Framework support for .NET Standard 2.0 and compiler features
- More secure SHA-2 support in ASP.NET and System.Messaging
- Configuration builders
- ASP.NET Execution step feature
- ASP.NET HttpCookie parsing
- Enhancements in Visual Tree for WPF applications
- Performance and reliability improvements
You can download the .NET Framework 4.7.1
Supported Windows Versions
The .NET Framework 4.7.1 is supported on the following Windows versions:
- Windows 10 Fall Creators Update (included in-box)
- Windows 10 Creators Update
- Windows 10 Anniversary Update
- Windows 8.1
- Windows 7 SP1
The .NET Framework 4.7.1 is supported on the following Windows Server versions:
- Windows Server 1709 (included in-box)
- Windows Server 2016
- Windows Server 2012 R2
- Windows Server 2012
- Windows Server 2008 R2 SP1
BCL – .NET Standard 2.0 Support
.NET Framework 4.7.1 has built-in support for .NET Standard 2.0. .NET Framework 4.7.1 adds about 200 missing APIs that were part of .NET Standard 2.0 but not actually implemented by .NET Framework 4.6.1, 4.6.2 or 4.7. You can refer to details on .NET Standard on .NET Standard Microsoft docs.
Experience in .NET Framework 4.6.1 through 4.7
- If you use Visual Studio 2017 15.3 or higher, the .NET Standard 2.0 support files are automatically copied to the application’s output folder.
- If you use Visual Studio 2015 and use NuGet 3.6, we will prompt you to install a support package which will handle copying the support files to the output directory.
Experience in .NET Framework 4.7.1
- These support files no longer have to be deployed with the application – they are built right into the .NET Framework itself.
- This also removes the need for binding redirects when using .NET Standard libraries on .NET Framework because the CLR automatically unifies version numbers of assemblies that are part of the platform.
Runtime – GC Performance Improvements
It comes with improvise allocation performance, especially for Large Object Heap (LOH) allocations.
ASP.NET Forms Authentication Credentials
It comes with new hash algorithm SHA-2 to store password in hashed format.
SHA-2 hash options like SHA-256, SHA-384 and SHA-512 are added in .NET Framework 4.7.1.
SHA-1 is still the default to preserve compatibility.
- Configuration builders allow developers to inject and build configuration for applications at runtime, allowing configuration data to be pulled from sources beyond the traditional .config file.
- In previous versions of the .NET Framework, configuration has been static. Applications only draw configuration data from a limited chain of .config files. With Configuration Builders, applications can apply a custom-defined set of builders to any section of config.
- These builders are free to modify the configuration data contained in the given config section, or build it entirely from scratch – possibly drawing new data from new sources that are not static files.
ASP.NET Execution Step Feature
- NET processes requests in its predefined pipeline which includes 23 events. ASP.NET executes each event handler as an execution step. With this new ExecutionStepInvoker feature, developers will be able to run this execution step inside their code.
- Today ASP.NET can’t flow the execution context due to switching between native threads and managed threads. ASP.NET selectively flows only the HttpContext which may not be sufficient for ambient context scenarios.
- With this feature we enable modules to restore ambient data. The ExecutionStepInvoker is intended for libraries that care about the execution flow of the application (tracing, profiling, diagnostics, transactions, etc.).
- We have added a new API to enable this: OnExecuteRequestStep(Action<HttpContextBase, Action> callback)
ASP.NET HttpCookie parsing
- It can be challenging parsing HttpCookie Set-Cookie/Cookie headers to read and write cookie properties from HTTP Headers.
- Now, we have provided support for a new API that allows for a standardized way to create an HttpCookie object from a string and accurately capture properties of the cookie like expiration date, path, the secure indicator.
- Furthermore, it assigns cookie value(s) appropriately. This new ASP.NET API for parsing HttpCookie from Set-Cookie/Cookie headers reads as follows: static bool HttpCookie.TryParse(string s, out HttpCookie result)
Compiler – ValueTuple is Serializable
- The ValueTupletypes in .NET Framework 4.7.1 are now marked as Serializable, which allows binary serialization.
- Since the syntax for C# 7.0 and VB 15.5 tuple types, for example, (int, string) relies on System.ValueTuple, this should make migrating from System.Tuple to using the new tuple syntax easier.
Compiler – Support for ReadOnlyReferences
- .NET Framework 4.7.1 introduces the IsReadOnlyAttributefor ReadOnlyReferences feature. This attribute will be used by the compiler to mark members that have readonly-ref return types or parameters.
- If the compiler is running against an older .NET Framework version, it will generate this attribute and embed its definition in the compiled assembly.
Compiler – Support for Runtime Feature Detection
- This new APIprovides a way to detect whether a particular runtime supports a certain feature or not.
- At runtime the check for feature support is done by calling a static method. This is enabled by the addition of the framework type RuntimeFeature.
- Tools can query it by calling the static method bool IsSupported(string) to check whether the feature is supported or not, by passing in the string name for a given feature.
Runtime – Support for Portable PDBs
- This feature adds support for Portable PDBs in the .NET Framework. Libraries that generate code at runtime, like C# Scripting, would benefit from being able to detect whether the runtime supports Portable PDBs or not.
- This is because they could emit Portable PDBs instead of Windows PDBs.
- Emitting Portable PDBs has performance benefits; it is faster and has much smaller memory footprint.
- In absence of this new API the library would need to resort to hard-coding build numbers of the mscorlib or conservatively assume that .NET Framework doesn’t support Portable PDBs.
- In addition RuntimeFeature.IsSupported method would be changed to return true if ‘PortablePdb’ is passed to it.
Continue Reading: What’s new in .NET Framework 4.7.1 Part 2
For now signing off until next post. If you have any queries/suggestions please let me know in the comment section below.
Thanks for reading!