The new 3.8 release ports additional WinUI controls and layouts, such as the often-requested CalendarDatePicker and CalendarView controls, to all Uno-supported platforms getting us one huge step closer to the #WinUIEverywhere vision.
Also, the new release brings up to 2x performance improvements in some scenarios, realized from the new Grid implementation as well as DependencyObject and UI Elements creation improvements. We also introduced new AOT and features for WebAssembly, built on top of recently released Microsoft work on .NET.
On the Linux front we enabled new scenarios so you can target embedded systems using the FrameBuffer as well.
In addition to new UI and Performance features and improvements, the team has closed 100+ issues. Closing issues timely is crucial in further fueling large projects enabling customers like Kahua to port a massive line of business applications from desktop to Web. We are particularly proud of the fact that with every release we close more issues than have been opened in the previous period; it shows a healthy open-source project. A huge THANK YOU goes to all our contributors.
Now, let us unpack the 3.8 release in more detail.
CalendarDatePicker and CalendarView
The date picker gives you a standardized way to let users pick a localized date value using touch, mouse, or keyboard input. With Uno Platform you can take that very same control to Web, Windows, Linux, macOS, iOS and Android. And of course, with Uno you can theme it with Material, Fluent or Cupertino look.
Shout out to @jeromelaban
Performance is a core feature for Uno, and we are always reevaluating the codebase with ways to improve. The recent updates in Visual Studio profiler (particularly the instrumentation mode) have allowed us to find significant updates to include in this release which apply to all target platforms.
The DependencyObject class is at the core of WinUI and it is often used for various UI operations. This makes any optimization done at that level have a global impact on the application performance.
For example, many DependencyProperty instances are keeping their default value, but also are never read. Changing this to create and compute the default value on demand improves object creation performance.
Similarly, many DependencyProperty instances are only having they local value set. We previously were creating an array for storing this single value to respect precedence but creating a fast path that only stores the default value and local value gave an interesting memory consumption improvement. In a large application, this change alone has an important impact:
A lower Garbage Collector handles count is particularly important, as it reduces the work needed to be done by the GC to complete its passes, and it ultimately yields shorter pauses caused by collections.
UI Elements Creation performance
In addition to the DependencyProperty changes, we have also made many changes to the way objects are initialized. Those changes lead faster UI creation, and less waiting for the end user.
For example, on WebAssembly some objects were creating event registrations eagerly for not-so-common scenarios (e.g., mouse wheel use), that were incurring a cost on object creation.
Another example is the Visual States materialization. Some control templates have very large definitions with multiple groups and dozens of states, some of which are used in edge cases (e.g. Drag and Drop in a ListViewItem). Originally in Uno, those large object graphs were created on object initialization. Now, those object graphs are created on demand, and only if a state is about to be used.
When measured, this change gives some amazing results, when comparing the 3.1 and 3.8 releases:
New Grid implementation
Shout out to @carldebilly
We have replaced our own Grid control implementation with the original WinUI Grid implementation, closing many issues related to discrepancies in behavior when comparing to apps running on Windows.
As a result, and because the WinUI Grid code has been fine-tuned by Microsoft for many years, the new Uno Platform Grid performance has improved by 2x as seen on the chart below.
Linux FrameBuffer and libinput support
Shout out to @jeromelaban
This removes the need for installing a X Server, but also comes with additional restrictions for the time being, such as TextBox (the current implementation relies on Gtk). If you need text input, you will need to implement an on-screen keyboard manually.
WebAssembly AOT Windows Support
Shout out to @jeromelaban
On the WebAssembly front, Microsoft has made noteworthy progress on the AOT front, making it stable enough to be used in large apps. The Uno.Wasm.Bootstrap 2.1 stable package now includes support for .NET 5 AOT, and you can upgrade to it by migrating to the net5.0 target framework using these instructions.
We are also introducing the Uno.Wasm.Bootstrap 3.0 preview package, which fixes support for the net5 debugger, removes the netstandard2.0 legacy head support and adds support for building for AOT on Windows. We always recommend using the latest stable release and are releasing the preview for those of you who want to live on the bleeding edge. We expect to come out of 3.0 Uno.Wasm.Bootstrap preview in the next few months.
You’ll find below some details about the changes for the 3.0 version:
Improved debugger support
The WebAssembly debugger support is now improved, to be aligned with the feature-set already provided by Blazor. This includes watch, stack traces, and many of the related recent improvements, and there is more to come, as the .NET team is working hard on it!
Removed netstandard 2.0 head support.
To support AOT on Windows properly, some incompatible changes are now forcing the netstandard2.0 target framework for head projects. This only means that you need to upgrade the head project to net5.0, and that netstandard2.0 libraries and dependencies remain very well supported. You do not need to change anything for those.
This target framework is a historical artifact related to the fact that there is no WebAssembly-specific TargetFramework defined, and we chose to equate it with WebAssembly. In practice, this meant that netstandard2.0 was using the mono/mono repository, and net5.0 is using the dotnet/runtime version of the runtime.
Windows AOT support
As the runtime support for WebAssembly was being developed, because of the original support for Linux from the emscripten tool, mono/mono and now dotnet/runtime were only supporting Linux for building AOT-enabled applications. On Windows, this meant for a while that you would need to install WSL to build such applications, as the Uno.Wasm.Bootstrap tooling would use it under the covers.
The story has now improved significantly, and both the .NET runtime and emscripten are supporting Windows properly. Uno is now inheriting from that capability.
To be able to build Uno applications that use WebAssembly AOT, or link to native libraries (such as SkiaSharp), you will need to:
– Install Python (from the store, preferably, or using Python’s official installer)
– Update Uno.Wasm.Bootstrap and Uno.Wasm.Bootstrap.DevServer to 3.0.0-dev.85 or later
– Build your application!
You can find an up-to-date set of requirements in the bootstrapper’s documentation.
Support for UniformGridLayout
Shout out: @carldebilly
Continuing our journey to include WinUI controls, we are adding UniformGridLayout in the supported list of ItemsRepeater layouts.
– Support for App/Windows Activation and visibility support (@MartinZikmund)
– Support for Application.Exit (Gtk/WPF) (@MartinZikmund)
– Gtk support for pointer cursors (@trungnt2910)
– Gtk/Wpf support for `Launcher.QueryUriSupportAsync` (@trungnt2910)
– App templates for WebAssembly are now using .NET 5
– Support for iOS universal links (@MartinZikmund)
– Many documentation updates (@davidjohnoliver)
We have also fixed about 100 various bug fixes that you can find in our release changelog on GitHub.
To upgrade to latest release of Uno Platform, please update your packages to 3.8 via your Visual Studio NuGet package manager! If you are new to Uno Platform, the best way to get started is following our official getting started guide.(5 min to complete)
About Uno Platform
For those new to Uno Platform – it allows for creation of pixel-perfect, single-source C# and XAML apps which run natively on Windows, iOS, Android, macOS, Linux and Web via WebAssembly. Uno Platform is free and Open Source (Apache 2.0) and available on GitHub.