The 3.2 release is loaded with features and performance improvements. Most of the release focused on upcoming .NET 5 and all benefits Uno Platform gets from building on top of it. However, we are also releasing improvements to the controls and tooling we introduced in previous releases.

Adding preview support for .NET 5 and .NET 5 WebAssembly AOT

The .NET team has been working hard to add WebAssembly support for .NET 5, and we’ve been able to leverage this work to update Uno and provide a preview of this support.
This update gives the ability for Uno Platform apps to use the .NET 5 APIs and features, like C# 9.0 and its source generators, records, pattern-matching-enhancements and others interesting features.

But that’s not all! The .NET 5 WebAssembly support comes with the IL interpreter runtime, but also brings the AOT support that was already present in the Mono Runtime that Uno Platform currently uses, giving a performance boost of 7-15x compared to the IL interpreter.

To get this support, the Uno WebAssembly Bootstrapper has been updated to include the AOT runtime for .NET 5, while keeping the support for the Mono 6.x WebAssembly support (using the netstandard2.0 target framework for projects).

Benchmark 1:

We’ve created some micro benchmarks to get a sense of the performance changes, comparing Mono 6 and .NET 5 WebAssembly, using System.Text.Json and Json.NET deserialization of a 1MB document:

These results are very interesting, as while System.Text.Json is significantly slower than JSON.NET using the IL interpreter, using AOT it’s slightly faster. Overall, in this test  AOT is about 7 times faster than the same interpreted code.

Benchmark 2:

Using the Raytracer benchmark sample, the results are more striking:

In this case, AOT is 15 times faster than the same interpreted code. The difference may be explained by the fact that the Ray Tracer sample is not using any of the BCL types, thus interacting less with the runtime.

It is interesting to note that the AOT and Interpreter performance is similar between Mono 6.x and .NET 5.
Finally, we’re actively working on getting .NET 5 support fully running on Uno, and you may find issues running the preview. If you do, please let us know by opening an issue!

Experiment with the .NET 5 WebAssembly support for Uno

You can give a try to the.NET 5 support in two ways, using Visual Studio 2019 16.8:

Upgrading an Uno Platform application to .NET 5 for WebAssembly

  1. Create an Uno Cross-Platform application using the Visual Studio Uno Platform templates
  2. Right click on the .Wasm project, then edit the csproj file
  3. Change netstandard2.0 to net5
  4. Update the Uno.Wasm.Bootstrap and Uno.Wasm.Bootstrap.DevServer nuget packages to at least 2.0.0-dev.69
  5. Press F5 to run the application
How to create a bare-bones console application
  1. Create a .NET 5 console application
  2. Replace the .csproj file content with the following:

 

<Project Sdk="Microsoft.NET.Sdk.Web">
  <PropertyGroup>
    <OutputType>Exe</OutputType>
    <TargetFramework>net5</TargetFramework>
    <MonoRuntimeDebuggerEnabled Condition="'$(Configuration)'=='Debug'">true</MonoRuntimeDebuggerEnabled>
  </PropertyGroup>

  <ItemGroup>
    <PackageReference Include="Uno.Wasm.Bootstrap" Version="2.0.0-dev.69" />
    <PackageReference Include="Uno.Wasm.Bootstrap.DevServer" Version="2.0.0-dev.69" PrivateAssets="all" />
  </ItemGroup>
</Project>

3. Hit F5 and go to the browser’s debugger console!

You may find up-to-date information for this sample in the Uno.Wasm.Bootstrapper repository.

Webinar: Uno Platform and .NET 5 (Dec 17th, 2020, Noon EST)

Adding support for .NET 5 in Uno Platform creates multiple opportunities to improve performance and reduce solution complexity. With .NET 5, we can better target traditional Microsoft Windows targets, but also WebAssembly, Linux and macOS. Come join us for a 30 minutes overview of how Uno Platform takes advantage of .NET 5, as well as for live Q&A with our CTO Jerome Laban.

Drag and Drop support (multiple platforms)

Drag and drop elements within the application is now supported. Like UWP, any element flagged with the `CanDrag` property set now has the ability to build a `DataPackage` and customize the UI for the drag operation. Any element configured with the `AllowDrop` flag can now receive the drag events.

We’ve also added the ability to drag and drop from and to other apps for Skia for Windows and macOS (Thanks @robloo !).

Uno Playground Updates

We’ve updated the Uno playground with new samples for you to experiment with:
TreeView, with Databinding
TabView
NumberBox
You can now use the “muxc” namespace to access Microsoft.UI.Xaml.Control enabled controls.

Other significant updates in Uno Platform 3.2

 

 

About the 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. The best way to get started with the Uno Platform is to check out the Getting Started guide (< 10 min to complete)

 

Jerome Laban, CTO – Uno Platform

Uno Platform 5.2 – True Single Project, enhanced Skia renderers, Multi Window and .NET 9 support , and more! See what’s new