Tangled in .NET: Will 5.0 really unify Microsoft's development stack?
.NET Framework? Mono? Xamarin? .NET Core? Blazor? Java interop?
Interview "There will be just one .NET going forward, and you will be able to use it to target Windows, Linux, macOS, iOS, Android, tvOS, watchOS and WebAssembly and more," Microsoft's Richard Lander promised on the announcement of .NET 5.0 at the Build 2019 developer conference.
.NET is Microsoft's development stack, which includes a runtime (the Common Language Runtime), a compiler, and numerous libraries and frameworks.
Programmer usage patterns expressed on a Developer DNA board at Build 2019
The reality is more complex than Lander implies. "Today we have at least three different frameworks," said John Montgomery, corporate VP in Developer Tools, who spoke to The Register at the software giant's Build conference in Seattle last week. "There is Mono, there is .NET Core (about to go to version 3.0), and there is full framework. Then there are variations on top of that. For example, Xamarin for mobile development uses Mono with some special compiler technology."
Even after the arrival of .NET 5, which is the successor to .NET Core 3.0, these three .NET frameworks will still exist.
"NET 5 is a superset of today's .NET Standard, which is the specification that says if you follow this specification you can run on any of them," said the Developer Tools supremo. "The big thing it's doing is unifying Mono and Xamarin with .NET Core. It is not bringing all the technology from full .NET Framework, which remains the thing that's going to be in Windows for a long time and will not move forward very much."
.NET 5 as Microsoft sees it
There are two reasons why .NET Framework 4.8 will remain supported for the foreseeable future. One is compatibility with existing applications, many of which will not be ported to .NET Core. Another is that two popular parts of the .NET Framework will not be in .NET 5. These are the Windows Communication Framework (WCF – one of the original three pillars of Longhorn, which became Windows Vista), and ASP.NET Web Forms, the original version of ASP.NET.
Microsoft's unification claim is not all smoke and mirrors, though. Mono and .NET Core will be much closer. "It's the unified Base Class Library that's probably the biggest unification; right now they have two slightly different implementations," Montgomery told us.
"Mono has been bringing code over from .NET Core for a while. So we're completing that work. And it's bringing the two compiler technologies together. Right now, on the Mono / Xamarin side we have an ahead-of-time (AOT) compiler which you need for iOS. That will come into .NET 5.0. And we will take the just-in-time (JIT) technology and enable the mobile technologies to run on top of the JIT as well.
"The Common Language Runtime implementation will be unified across Mono and .NET Core. And the library system on top will be then honed to different scenarios. So there will be a set of libraries for mobile, a set of libraries for microservices, a set of libraries for desktop development and so on."
Despite this, Mono will not go away, he told The Reg. "We'll invest less engineering effort in Mono. It will mostly flow into .NET 5.0. The community will probably invest less engineering effort and gradually workloads will move onto .NET 5.0. But we're not going to try to kill the project. There's still big applications that depend on Mono and may never port to use .NET 5.0."
One of the issues is that Mono supports a cross-platform GUI for desktop applications. Will Microsoft provide a cross-platform GUI for .NET Core?
"We continue to look at that. There are some performance and design deficiencies with that technology. Visual Studio for Mac uses Mono and has some challenges with things like accessibility. Right now we're mostly focused on the mobile scenarios where Xamarin Forms is our primary answer," said Montgomery.
Although .NET Framework will continue, you can also compile Windows desktop applications with .NET Core 3.0 (currently in preview) and higher. This is true for all three Windows GUI frameworks: Windows Forms, Windows Presentation Foundation (WPF), and Universal Windows Platform (UWP). These frameworks are now open source; but note that it is only the .NET Core ports that are open source. As these evolve, will the .NET Framework versions get updated?
"The engineering team doing WPF or Windows Forms for .NET Core are the same engineering team doing it for Windows, and if there are smart changes that they can bring back they might upstream them, but that’s not the intent," said Montgomery.
Windows desktop developers using .NET 5 will have two options for deployment. "They can effectively bind a specific .NET Core with their application and deploy that. The other [option] is, there is a system-wide .NET Core in a common location, and the app will go to that location and if it doesn't find a .NET Core will install [it].
"It's more like the .NET Framework except you can have multiple .NET Cores side by side even at the system level. That enables us to service one common component if there's a security vulnerability. If you build your static version, you have to service that as a developer," Montgomery told The Reg.
At this point in our interview, things get a little confused. "I don't think we've serviced .NET Core through Windows Update," Montgomery said. But that is envisaged? "Maybe. We haven't made the decision yet."
But you just said it would be serviced through Windows Update. "It can be." The concern, he said, is introducing breaking changes "especially with the velocity .NET has moved at".