Uno Platform 4.6: Hello .NET 7!

Today we are announcing support for .NET 7. Our sixth release of 2022 is a massive step towards creating the most productive platform for building .NET-based applications which run everywhere

Our end-to-end application development story is increasingly converging. Of course, using only one of the parts, such as our core UI work, will speed up your cross-platform development. But the productivity gain resulting from using all Uno Platform pieces – across UI, Figma, Extensions, and Toolkit is significantly more extensive than the sum of its individual productivity boosts.  

Let’s dig into the highlights: .NET 7 support, Library Assets, SVG Support, Android 13, the new WebAssembly Bootstrap 7.0, and ASP.NET Core Hosting Project. For a detailed list of over 200 PRs, please head to our release notes on GitHub. 

.NET 7 and Visual Studio 17.4 Support

We’ve been closely monitoring and contributing to .NET 7 preview releases and keeping compatibility in lockstep with its advancement. Given our compatibility with .NET 7 RC 2 and RC 2 quality overall, we can confidently say Uno Platform will support .NET 7 on November 8th, when it launches. 

.NET 7 is often described as ‘the fastest .NET yet.’ We couldn’t agree more. Developers are using Uno Platform 4.6 and will later experience notable performance improvements. Our internal performance benchmarking shows a performance boost of 20%-50% in critical paths. We hope you can join our CTO’s session at .NET Conf, where he will dig deeper into the performance topic.  




We’ve been using .NET 7 to power our WebAssembly apps since last May, such as the Uno Playground and Uno Gallery, and it’s been very stable and performant!

Support for .NET 7 consists of two parts, one for Skia (Gtk+WPF) and WebAssembly, and the second one for the Mobile targets (iOS, Android, Catalyst and macOS). 

  1. For Skia and WebAssembly, Uno.UI has been built using the netstandard2.0 target for the past 4.5 years as it was the most broadly supported API set. We’re now adding the .NET 7 binaries, and it allows the use of the new JSImport/JSExport APIs to improve the performance of WebAssemby apps. We’ll be diving into that feature for a future release to improve Uno.UI’s own JS interop code. Early synthetic benchmarks have shown a very promising 2x performance improvement. 

  1. For .NET Mobile, the inclusion of .NET 7 allows Uno.UI itself to use of iOS 16 APIs as well as newer and faster APIs. 

The support for .NET 7 requires Visual Studio 17.4 Preview 5 or later.  

Library Assets

This new release introduces the highly requested ability for NuGet packages and in-solution library projects to include content assets to be deployed as part of the application. 

This WinUI feature is commonly used to include images, fonts or other application files from projects and NuGet packages in the main app. These assets are marked as “Content” build action in a project and are automatically useable with the `ms-appx://mylibrary/` prefix in images and the StorageFile.GetFileFromApplicationUriAsync() method.  

If you’ve been in the .NET ecosystem for a while, you may certainly know about the .NET embedded resources, you may wonder why this feature is important. Embedded resources are unconditionally loaded as part of assemblies, making those eagerly loaded by the different runtimes on iOS, Android or WebAssembly, degrading startup performance. Using Content Assets, Uno Platform can lazily load the payload. It is an important feature on WebAssembly to get faster initial download performance. 

This new feature also paves the way for having fonts included as standalone packages, as well as any other resources type that a project may need. It is also automatically enabled when creating a new Cross-Platform library and can be added with a “GenerateLibraryLayout” property if you have an existing library. 

Support for SVG

SVG is a convenient vector-based image format ideal for scalable graphics and iconography, making it easy to display high resolution imagery on a wide range of display resolution and density. With Uno Platform 4.6 we are bringing support for SVG to all supported platforms as a source for the Image control.

To use SVGs, install the following packages into the iOS, macOS, Mac Catalyst, Android and Skia projects:

When installed, you can display any SVG file in an Image control by referencing it from the source property. For example:

				
					<Image Source="ms-appx:///Assets/heliocentric.svg" Stretch="UniformToFill" Width="100" Height="100" /> 
				
			

It can also be used as a SvgImageSource:

				
					
<Image>
  <Image.Source>
    <SvgImageSource UriSource="https://example.com/test.svg" />
  </Image.Source>
</Image>

				
			

For step-by-step guide on how to use SVG in your Uno Platform apps check out documentation. 

Android 13

Uno.UI now supports the Android 13 SDK and has removed the support for the Android 11 SDK, as the Google Play store stopped accepting level 11 and below. 

Note that Android 5.0 is still officially supported for the minimum device SDK level. 

WebAssembly Bootstrap 7.0

Along with the .NET 7 support, we’re introducing a stable version of the Uno.Wasm.Bootstrap package, the foundation of Uno.UI’s WebAssembly support. We’ve adjusted the versioning scheme so that the major version number matches the associated .NET runtime version. 

This new version of the bootstrapper is backward compatible with your net6.0 apps, and you don’t need to upgrade to .NET 7 to use it.

This release is built using the .NET 7.0.100 sources that the .NET team will use on release day, meaning that you’re already set to use the latest and greatest. 

This release introduces a lot of new fixes and features, let’s dive in detail. 

Obfuscation and custom extensions support has been added to work around firewalls and antiviruses that may block .NET binaries. Uno already uses the “.clr” extension, yet some anti-viruses may still detect the Win32 header through deep inspection, which simple obfuscation can work around. 

Static assets support, used for ASP.NET Core hosting. See the ASP.NET Core Hosting section in this post for more information. This feature allows for an ASP.NET Core project to take a “project reference” on a WebAssembly app, to include its output in the “wwwroot” folder to deploy in a single package. 

Threading preview support, a big demand for performance hungry users. Threading makes use of WebAssembly threads and comes close to the desktop threading model. A new SynchronizationContext has been introduced to easily go back and forth the main thread. The support is still in preview as there are still some threading affinity issues with JS-bound APIs that need to be fixed. As we mentioned back in June, give it a try and let us know what you can do with it! 

Also note that threading requires a specific security context in browsers, which can cause SSO flows to fail. 

Threading can be enabled using “<WasmShellEnableThreads>true</WasmShellEnableThreads>” in your csproj. 

SIMD support, another big demand from performance hungry apps. This feature enables the use of the Fixed-width SIMD WebAssembly specification and is available when building with AOT enabled. The hardware support for SIMD can be checked through the Vector.IsHardwareAccelerated. 

Native libraries support updated layout, where the inclusion of optional Threading and SIMD makes for a new matrix of possibilities for native libraries. While threading is supported by all browsers (its preview status and security restrictions can make it inapplicable for some apps), and SIMD is not yet supported by Safari, it’s required for native libraries to be providing a matrix of already compiled versions of binaries. 

You’ll find examples of this new format in Uno.Sqlite-wasm and SkiaSharp, which looks like this in a package: 

 

Native signatures generation support, which enables P/Invoke signatures to be anything that the app’s code will provide. This is particularly useful for interoperability with large native libraries, like SQLite. 

Finally, as the main branch of dotnet/runtime is already on .NET 8, so are the Uno.Wasm.Bootstrap development builds, and there are some amazing improvements coming. 

ASP.NET Core Hosting Project

The Uno UI App template now provides a new project type to host your applications in an ASP.NET Core app. This is particularly useful for developing your app alongside its Web API project and avoiding cross-site security concerns. 

Select the ASP .NET Core Server option to enable this new project in the Visual Studio new project dialog. 

This feature has already been used to demonstrate the use of Uno Platform to make Microsoft Teams apps: 

Other notable changes

  • x:Bind pathless casting, to allow for self binding scenarios 

  • Improved x:Bind type casting and attached properties support 

  • Improved Attached properties localization, particularly useful for tooltips 

  • Large improvements in the Source generators Uno.UI uses, reducing the memory pressure on Visual Studio when editing and building applications. 

Community Shout Out!

Our contributor community just passed 400 contributors across all our repositories – be it the core UI one, documentation, or Gallery.   

  • @SeanKilleen for the automated spell-checking of markdown documentation 

  • @blouflashdb for template updates 

  • @pkar70 for the PhoneCallHistory implementation for Android 

  • @seanocali for the support of CustomResource in XamlReader 

  • @workgroupengineering for source generation project cleanup 

  • @topperdel, @IrvinDominin, @peterfoot for documentation updates 

Big shout out to all our new contributors who came during our Hacktoberfest initiative, helping make our Gallery loaded with new samples.  

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. It offers Figma integration for design-development handoff, and a set of extensions to bootstrap your projects. Uno Platform is free and Open Source (Apache 2.0) and available on GitHub.

Conclusion and Next Steps

As we stated in the beginning, using more than one piece of Uno Platform’s offering brings exponential productivity to your development process. We hope you see our vision of how future .NET applications will be created – ultimate productivity and control for developers resulting in visually appealing, delightful end-user experiences. 

If you are new to Uno Platform, please give Uno Platform 5-minute Getting Started tutorial a go.   

Tags:

Share this post:
Tune in Today at 12 PM EST for our free Uno Platform 5.0 Live Webinar
Watch Here