So how's .NET 6 coming along? Oh wow, Microsoft's multi-platform framework now includes... Windows
BlazorWebView arrives on desktop applications. Too convoluted?
Microsoft has shipped preview 3 of its forthcoming .NET 6 framework with a bunch of updates including the addition of Windows desktop to its Multi-platform App UI (MAUI).
As the first long-term support version of the supposedly unified framework, .NET 6.0 is expected to be completed in November. Like .NET 5.0, it is no longer designated .NET Core, though it remains distinct from the Windows-only .NET Framework, which is still supported but will not be further developed.
.NET 6.0 has added Android, iOS, Mac and Windows ARM64 to the list of supported platforms, with mobile and Mac GUI support coming from the integration of Xamarin Forms. Although .NET 5.0 was released in November 2020, its short supported life means that .NET 6.0 may prove the more important release.
Using Xamarin Forms developers could target iOS, Android, and Windows 10 UWP (Universal Windows Platform), but not Windows desktop applications. A start was made on targeting Windows Presentation Foundation (WPF), but this was never completed. .NET MAUI on the other hand can target Project Reunion and WinUI 3, this being what Microsoft regards as the future native user interface framework for Windows 10.
In the latest preview, Project Reunion has been added, which is why Principal Program Manager David Ortinau said: "Now Windows joins Android, iOS, and macOS as target platforms."
The updated MAUI preview has also added a new way to hook into the native platform lifecycle events (such as when the application is launched), an improved Grid layout, and accessibility improvements via new semantic properties.
Although Project Reunion runs as a desktop application, it has a look and feel more like UWP. It is also limited to Windows 10 from the 2018 update, causing some complaints from developers who want to target a wider range of Windows versions. "Windows 7, Windows 8 and Windows 8.1 still have ~20 per cent of market for today," said one.
There is more than MAUI in .NET 6.0 preview 3. Program Manager Richard Lander said the preview has a number of "low level performance features" including an unsafe but fast API for updating struct values, interface casting performance improved by 16-38 per cent, and several code generation improvements have been made.
There is also initial support for .NET Hot Reload, which applies code changes to a web application without restarting it, using a tool called dotnet watch. And there is new support for shadow copying on IIS, the Windows web server, enabling application binaries to be replaced while an application is running.
BlazorWebView controls for desktop applications
BlazorWebView controls allow developers to embed Blazor web components in WPF and Windows Forms desktop applications, MAUI support is promised too
We ran up a hybrid WPF and BlazorWebView application using a sample from developer Jorge Arteiro. It worked, but for an application running on the desktop on .NET 6.0, does it make sense to embed chunks of C# running on a separate .NET runtime delivered via web technology?
Lander said Hot Reload will come to all .NET application types including WPF, Windows Forms, MAUI, and more. He added that in terms of features "we're now about halfway through the .NET 6 release." ®