Microsoft releases .NET 7 spanning Windows to WebAssembly, but can it keep up with the modern web platform?

Microsoft releases .NET 7 spanning Windows to WebAssembly, but can it keep up with the modern web platform?

Microsoft has released .NET 7, along with a flurry of updates to related frameworks and tools, including C# 11, F# 7, Entity Framework Core 7, ASP.NET Core, .NET MAUI (Multiplatform App UI), and Visual Studio on Windows and Mac.

This is not a long-term support release though, and will be supported only for 18 months, to May 2024. The short support lifecycle is not necessarily a barrier to production use, however, as containerized applications with automated testing and deployment are relatively easy to upgrade.

The .NET platform is multi-faceted. It began as a better Visual Basic and Microsoft’s answer to Sun Microsystem’s Java, the first generally available release being in January 2002. Despite its Common Language Runtime, the core language of .NET has always been C#, designed by Anders Hejlsberg who had previously worked on Object Pascal and Delphi, and went on to create TypeScript.

Today, .NET has several distinct pools of users. On Windows, since its first launch, it is the natural choice for line of business applications that are relatively quick and easy to code. Many of these still use the Windows-only .NET Framework, which is feature-frozen but, as Microsoft points out here, will continue to ship with Windows and is supported and patched along with the operating system.

There is news today for these traditional users: Visual Studio 17.4 is now native on Arm64, and “we are extending native Arm64 support for the .NET Framework in the form of .NET Framework 4.8.1 runtime and SDK,” said senior program manager Mark Downie. Therefore, stalwart Windows Forms applications may now run better on Arm64 PCs, as Microsoft attempts to haul Windows into the more efficient Arm ecosystem – provided that no x86 dependencies exist.

Another aspect is what one might call modern .NET, which is cross-platform on Windows and Linux and optimized for container deployment, now “a supported output type of the .NET SDK,” according to the release post from the .NET team. Although .NET is still widely perceived as a Windows technology, the reality is that for server applications Linux is often a better and more cost-effective choice. Microsoft will be happy presuming that some of those applications end up deployed onto its increasingly Linux-flavoured Azure cloud.

The .NET team has delivered well in respect of migrating the platform from Windows to cross-platform, containers and microservices, keeping faith with developers who adopted C# in its Windows-only days.

It is a competitive choice today, though a few things spoil the picture. One: Microsoft has struggled to provide a cross-platform GUI for .NET, with Windows Forms and WPF (Windows Presentation Foundation) remaining Windows-only. The official solution is MAUI, development of which has been slow. Secondly: Visual Studio runs best on Windows, with a Mac version that has a fraction of its features, and no support for Linux (the highest-voted feedback request). Visual Studio Code runs everywhere and also supports .NET but Microsoft seems caught between preferring Visual Studio for commercial reasons, and investing in .NET on VS Code which would benefit the wider platform.

The .NET platform also faces stiff competition from JavaScript/TypeScript on the V8 runtime which powers Google Chrome and also runs serverside, with impressive performance and useful features like Isolates for lightweight runtime instances.

Starting a Blazor WebAssembly project in Visual Studio Mac

That said, there is a bridge between the .NET and V8 worlds in the form of WebAssembly (Wasm), with or without Blazor, a framework which is part of ASP.NET core. In the new version, Blazor has improved JavaScript interop and better performance  via “.NET WebAssembly ahead-of-time (AOT) compilation using WebAssembly SIMD and exception handling support,” as principal program manager Daniel Roth explains
Perhaps Blazor rather than MAUI is the better route to that difficult cross-platform GUI for .NET. Such is the flexibility of .NET, developers can even meld the two together.