Back in May 2019, Microsoft had announced that the next big release in .Net family, after .Net Core 3.0, will be .Net 5. In the introduction of .Net 5, Richard Lander – Program Manager of .Net team – stressed that there will be just one .Net going forward, which will work across all platforms like Windows, Linux, Android, macOS, iOS, tvOS, watchOS, WebAssembly, and other future platforms.
They wanted to create a ubiquitous .Net app development model that has the following qualities,
- Capable to work with native cross-platform
- Compliant with HTML5
- Unswerving User Experience
- Cross-boundary accessibility
- Powered with Xaml – one of the great inventions by Microsoft
- Compatible object serialization
- Consistency for holistic development
And finally, Microsoft has published seven .Net 5 previews between March 16th – July 21st of this year. In the announcement of the seventh preview, it is notified that only one more preview of .Net 5 will conclude its release cycle with all the possible features and performance enhancements before its general availability in Nov 2020. Microsoft has also promised to introduce new .Net APIs, language features, and runtime capabilities as part of .Net 5 release.
The .Net team of Microsoft promised that the upcoming .Net 5 development stack will include the major enhancement that will improve the quality and performance of applications based on .Net Open source platform. The .Net 5 will contain compilers, runtime components, and languages to develop applications for web, desktop, mobile devices, clouds, gaming, IoT, and AI.
The .Net 5 is created with high-level goals that include providing cohesive .Net SDK experience with a single Base-Class Library (BCL) and support for native and web applications across all .Net 5 application and multiple operating systems. .Net 5 will have Xamarin integration for mobile development which means .Net SDK will have support for mobile too.
The .Net 5 native applications will have support for multiple platforms like Windows Desktop, Microsoft Duo (Android), and iOS. It will include support for web applications of a single Blazor project that can work on multiple platforms.
In addition to that, .Net 5 platform also intends to support faster BCL algorithms, building high-performing cloud applications, support for HTTP3, and better support for runtime containers. This unified platform will include ASP.Net Core, Core Entity Framework, WPF, WinForms, Xamarin, and ML.Net along with the support for Windows on Arm64 and many more features still to be released.
The masterplan of Microsoft with the .net 5 release was to unify the .Net framework and .Net Core platforms into a single unified .net platform that goes forward. But due to the recent events like COVID-19 pandemic, the progress of the “just one .Net platform going forward” vision of the Microsoft has seen some backlogs.
In the fourth preview announcement of the .Net 5, Scott Hunter – .Net team Director Program Management said that last year they promised to unify the .Net Core and Mono/Xamarin implementations into one Base Class Library and SDK toolchain.
But in the wake of the global pandemic, they had to adapt to the changing needs of customers to assist and provide the support for their most urgent needs and as a result above mentioned feature will be available in preview by Nov 2020’s .Net 5 release except the unification part, which will be available with .Net 6’s Long Term Support release in Nov 2021 – he added.
While the .Net Core features like side-by-side installations, Visual studio integration, and cross-platform functionality will be retained in .Net 5, it will also have new and advanced functionality that makes it fast, scalable and highly productive. Few advantages of .Net 5 are,
- Cross-platform implementation of .Net applications on any device.
- .Net 5 supports all key features of platforms like .Net Framework, Xamarin, .Net Core.
- Fast, scalable, high-performing, and highly productive application development.
- This .Net upgrade is based on Open-Source code and is community-oriented.
- Microsoft promised to support .Net 5 with Visual Studio Code, Command Line Interface, and Visual Studio for Mac for future updates.
- Also, it has features like Windows Forms and WPF on Windows for specific platforms.
- .Net 5 also includes side-by-side installation, small project files, and smart deployment packages.
In addition to that, .Net has following features for developers as well,
- Microsoft has made it possible to have more choices and pick the runtime experience you want.
- Java interoperability across all platforms will be available.
- .Net 5 will have the support of Objective-C and Swift interoperability on multiple OSs.
- CoreFX support to .Net static compilation.
Microsoft has released seven previews at the time of writing this post which extensively demonstrates what users may expect from the .Net 5 release. Now, let’s analyze all the seven .Net previews and what features and enhancement they each bring to the table.
Let’s start with the improvements included in the first preview of .Net 5.
- Preview 1 includes few RyuJIT code quality improvements. Observing the patterns of null check where they are unnecessary, the need to generate null checks is removed from more cases. The JIT will collapse the duplicate expression that needs to be evaluated only once. The “constant string” length is optimized to collapse code down to correct integer value. The JIT has re-order phases, which allows it to use key optimization earlier, which gives better code quality and reduced work for coming phases that enhances the JIT throughput.
- The .Net 5 has added information about assembly load to the event pipe.
- The event pipe is a subsystem introduced with the .Net Core 2.2 and with .Net 5 it has been extended with the feature to write event pipe events by enabling profilers.
- .Net 5 will have a reduced number of GitHub repositories, which were used for building and packing .Net.
With this first preview, Scott Hunter – Director Program Management of .Net – urged people to move all applications from .Net Core to .Net Core 3.1 so that the transition from 3.1 to .Net 5 can be made easy and as painless as possible. Also, he stressed on leaving the .Net framework for building applications and instead build them on .Net Core 3.1.
Let’s see the enhancements included in the second preview of .Net 5.
- This preview of .Net 5 includes many RyuJIT code quality improvements that make the performance of .Net 5 applications better. It includes a change to x86/x64 zeroing code, enabling of optimizer for SIMD, improved optimization for Nullable<T>, improvements in range check elimination and type check expression, and other minor improvements.
- Also, Garbage Collection marks a few significant improvements. Different threads of server GC can work-steal when the older generation objects held live gen0/1 objects. Due to this, ephemeral GC pauses will become shorter for situations where some of the GC threads took too long to mark.
- A new feature named Pinned Object Heap gets introduced and implemented the part internal to GC. It will allow GC to handle pinned objects separately, which helps to avoid the negative effects of it on generational heaps as a result. .Net 5 will have better heap usage by enabling the LOH allocation from the free list while sweeping of SOH is underway by the Background GC. Along with these, the preview also includes BGC suspension fixes.
The third preview of .Net 5 contains the following enhancements.
- The major highlight of this preview is improvements made in the code quality of RyuJIT. The Vectorise BitArray class was updated using ARM64 intrinsics. A new capability, On-Stack Replacement allows you to change the code in the middle of execution if you execute the code with the current method of execution. It is experimental and targets on improving the performance characteristics of tiered compilation. Some uses of dynamic generic dictionary expansion have better performance in .Net 5. Code quality improved for generic Ready2Run images, and structs as arguments in “tail call” position calls.
- Another highlight of the preview is improvements made in System.Text.Json. The addition of support for preserve references enables ReferenceLoopHandling, one of the key features of JSON.Net serialization. A new extension method added that allows serialization from/to JSON for Httpclient. Also, added support for immutable classes and structs to JsonSerialization along with null value handling.
- The .Net team has added .Net SDK support for .Net framework assemblies, which will auto-reference it. This change allows building .Net framework applications and projects without installing a separate .Net framework package.
.Net 5 team released forth preview on 19th May with the following features. We have already discussed the delays in “just one .Net going forward” vision of the Microsoft due to ongoing pandemic earlier in the post.
- This preview includes support for C# 9 and F# 5.
- The improvements made in the performance of the whole product that includes the performance of strings, regular expressions, the performance of HTTP 1.1 and HTTP/2, performance of tiered compilation, stack prolong zeroing and F# tailcalls have also been improved.
- Increased focus with an emphasis on P95+ latency on predictably consistent performance, reducing performance cliffs and outliers.
- Single file application execution improvements.
- .Net 5 now can natively run on Windows ARM64 and support development and deployment.
- ARM64 performance has been improved for Linux and Windows in JIT and BCL libraries.
- Containers have been improved to reduce image size and implement new container APIs that enable .Net to stay updated with runtime evolution of container.
- Migration from Newtonsoft.Json to System.Text.Json made easier for JSON APIs.
The fifth preview was released on 10th June 2020. It covers most of the features that will be included in the final product. So, let’s look at the features in .Net 5’s fifth preview has in store.
- RyuJIT now has a new and much faster, portable implementation of tailcall helpers. The JIT will ask for help when it knows it will need a helper to perform a tailcall. Also, the progress continues for the ARM64 hardware intrinsics implementation for RyuJIT. Improved JIT speed if it was affecting the compilation of regular expression. Also, the performance of Intel architecture is improved with new hardware intrinsics.
- After some requests, the .Net team allowed exports to take place for native binaries that calls into .Net code for too long. Now, it allows you to expose native custom exports, support for cross-platform, and doesn’t need high-level interop technology like COM.
- Announced breaking change of removing built-in WinRT support from .Net 5, which will be part of the sixth preview.
- DirectoryServices.Protocols expansion for Linux and macOS.
- Added support for Alpine 3.12 in .Net 5 and .Net Core 3.1.
First, let’s take a look at the sixth preview of .Net 5 released on 25th June 2020.
- The .Net developers in a breaking change have removed the built-in WinRT (Windows Runtime) support, which was part of the .Net Core 3.0 update. They have replaced it with the C#/WinRT tool chain, which the Windows team provided to .Net team for .Net 5. So, now those .Net Core 3.x applications that use WinRT must need to be recompiled and more information will be provided in upcoming previews.
- The benefits of doing so are that you can separately develop and improve WinRT interop, it makes the WinRT more symmetrical as they are provided for other operating systems, the removal will simplify the runtime codebase of .net.
- The latest preview of .Net 5 SDK includes support for Windows Forms, which means that Windows Forms application can be built and run on Windows ARM64 devices. Also, the work for adding support for WPF is on the way.
- The RyuJIT team of .Net development has provided quality improvements such as Struct handling and Optimization to remove redundant Zero initialization. Also, the .Net team made progress on the implementation and optimization of ARM64 hardware intrinsics. And the code size was greatly improved and reduced for ARM64.
- The team has also updated the .Net 5’s OS version page that captures the latest platform support plans.
At the end of this preview, Richard Lander – Program Manager of .Net Team – said that they have passed the half-way of the .Net 5’s release cycle and now they are starting to close down the release as matter of fact.
The seventh Preview of the .Net 5 has just been released on 21st July and has few improvements as most are already covered in past preview releases. It is the second last preview which means there is still one more preview in the pipeline before the actual release. So, let’s look at the enhancements covered in the seventh preview of .Net 5.
- Usability features added in the JSON API. The breaking change here is the added ability to ignore default values at the time of serializing for value type properties, which reduces serialization and wire cost. Also, .Net 5 will have the ability to handle the circular references at the time of serializing and the shape of API will get final.
- The new GC.GetGCMemoryInfo API included, which returns the GCMemoryInfo struct. It provides memory info of the machine, heap memory, and the most recent memory collection or the most recent ephemeral, full blocking, or background GC collection, which you have specified. Another impactful but small change, which can lower the GC latency and CPU usage in general was made to defer the expensive reset memory operation to low memory situation.
- Most of the RyuJIT enhancements focus on improving the performance of .Net applications. And the seventh preview provides significant general improvements along with ARM64 hardware intrinsics and API optimization.
In the seventh preview, Richard Lander talked about the recent devblog enlisting the performance improvement of .Net 5 posted by Stephen Toub – Partner for Software Engineer of .Net team. In the very detailed post, he said that .Net 5 already has a wealth of performance enhancements and still, there are likely chances to include a lot more improvements before the official release scheduled later this year.
Toub also highlighted the 250+ GitHub pull requests, which contributed to creating .Net 5 with the myriad of performance improvements – he added. The following areas of .Net platform will see improvements in performance once .Net 5 releases.
- Garbage Collection
- Just-In-Time (JIT) Compiler
- Runtime Helpers
- Text Processing
- Regular Expressions
- Threading and Async
- Peanut Butter (Lot of small enhancements that don’t make a huge difference but cumulatively address the costs, which needs fixing to make a measurable difference)
- New Performance-Focused APIs
- New Performance-Focused Analysers
The massive post by Toub goes extra in-depth into explaining each area with examples and shows how it performs against the past .Net Core upgrades. The tl:dr category post ends with Toub saying that even after demonstrating a vast number of improvement, there are a plethora of further performance advancements that will be added before .Net 5’s general availability.
To get ready for that with absolute surety, they have asked feedback that would give them more insights on the prevailing issues in any preview release of .Net 5, missing capability in existing features, and any missing feature to be added or design suggestions for in-progress features.
.Net 5, when it releases, will be one advanced open-source platform to build your applications that work cross-platform with multiple operating systems. It is going to ease the life of .Net developers with lots of new and advanced features and many more to come as stated in previews. You can always consult our experts if you have any doubts to clear or want to know more in detail and how .Net 5 will revolutionize the modern apps. The team of M-connect Solutions with a pool of talented .Net developers has vast experience cross-platform and web or mobile applications based on .net.
About Darshit Parmar
Darshit Parmar is expertise with Project Management and SEO Analyst, and shares his 10 years of experience with Ecommerce Business Owners in making their brands and business a place in their own field.Read More