It is just two more months until .NET 5.0 is scheduled to be ready for the big stage, giving Microsoft time to push its first platform release candidate (RC) out of the door and look into the future of the .NET standard.
The new release is about to become the cross-platform successor of the software development platform .NET Framework, which was started as an alternative to the Java platform in the late 1990s. .NET 5 is based on the .NET Code implementation of the framework and follows Microsoft’s “one .NET vision” by suspending the difference between the .NET standard and its implementation.
The aim, said Microsoft, is to provide “a uniform set of capabilities and APIs that can be used for Windows desktop apps, cross-platform mobile apps, console apps, cloud services, and websites”. To get there, the .NET team has not only worked on the platform’s structure, but has also been busy getting ARM64 support improved, leading to better throughput and smaller binaries, and sprucing up the performance of .NET libraries amongst other things.
The RC also introduced single-file apps, surprised developers with a new Half type (“a binary floating-point number that occupies 16 bits”), and added more trimming options to reduce the size of self-contained deployments. And since everyone loves a good programming language, it threw in new versions of C# and F# as well.
New F# 5 features include string interpolation, nameof support, and open type declaration, which are similar to open static classes in C#. Meanwhile C# 9 developers will have Records, an immutable data type useful for storing small amounts of data, and init-only properties to get familiar with.
For those who have tried to stick to the .NET Standard and are wondering how to carry on with .NET 5 around the corner, .NET program manager Immo Landwerth expanded beyond the classic “it depends” response with a detailed blog post. According to Landwerth, the Standard has suffered from some issues which made it harder to use effectively than would be desirable. Problems range from its slow versioning speed, which prevents devs from using the latest features, to its complex nature and platform-specific APIs.
Of course .NET 5 tackles most of the problems by combining the standard with the core library and promises to support .NET Standard 2.1 and earlier versions, but this isn’t meant to render the old standards worthless right away. For now, Landwerth suggested using “the netstandard2.0 to share code between .NET Framework and all other platforms”, while those wanting to share code between Mono, Xamarin, and .NET Core 3.x are advised to stick to netstandard2.1.
“The only reason to retarget from .NET Standard to .NET 5 is to gain access to more runtime features, language features, or APIs “, he said, as “.NET Standard 2.0 gives you the most reach while supporting .NET 5 ensures you can leverage the latest platform features” for .NET 5 users. Looking ahead, .NET 5 and its successors are meant to be the “foundation for sharing code”. Updates are planned on a yearly basis, with even numbers releases becoming long term support versions so that teams are able to plan better.