WebAssembly

The State of WebAssembly – 2021 and 2022

In this article, I’m going to take the same approach that I used last year to show you the current state of WebAssembly. I’ll look at the big events of the past year and then try to predict where I think things are going in 2022. 2021 in Review This past year turned out to be a much bigger year for WebAssembly than I was expecting, especially around the Safari web browser. Safari When the MVP of WebAssembly was released back in 2017, Safari was right there with the same features as the rest of the browsers. In the years that followed, Safari unfortunately fell behind. Over 2021, I was very pleased to see a lot of work put into Safari to bring its WebAssembly support up to date. As of the Safari 15.2 release on December 14th, some of the features added to Safari over 2021 include: Streaming Compilation Bulk Memory Operations Addressable Memory can now reach 4GB Exception Handling Support for the COOP (Cross-Origin-Opener-Policy) and COEP (Cross-Origin-Embedder-Policy) response headers Atomic Instructions The re-enabling of the SharedArrayBuffer for sites that use the COOP/COEP response header SharedArrayBuffer WebAssembly uses the SharedArrayBuffer to share memory between WebAssembly threads. Unfortunately, the buffer

Uno Platform SQLite for WebAssembly support on .NET 5 and .NET 6

WebAssembly Support for SQLite and Erik Sink’s SQLitePCL.raw has been present in Uno Platform for quite some time now, when running under the mono runtime but .NET 5+ support was missing. We’re pleased to announce that support has now been added in our SQLite provider for WebAssembly starting from 3.1.1, allowing to build with the latest and greatest features available, alongside with Entity Framework Core 6 previews and the Frank Krueger‘s awesome sqlite-net-pcl library. We’ve updated our online sample repository for you to try SQLite and EntityFramework Core directly in your browser: https://sqliteefcore-wasm.platform.uno   Getting started using SQLite in your browser You can find an up-to-date documentation for this walkthrough here, the full example for this tutorial here, and Entity Framework Core sample here. First, you’ll need to setup your environment using our getting started steps. Once you’re done, you can create a new application using our visual studio extension or dotnet new templates. You’ll then need to add new dependencies in your application as follows: <PackageReference Include=”sqlite-net-pcl” Version=”1.7.335″ /> <PackageReference Include=”Uno.SQLitePCLRaw.provider.wasm” Version=”3.1.1″ /> <!– Required when using sqlite-net-pcl which otherwise overrides the WebAssembly compatible version of the SQLitePCL.raw provider. –> <PackageReference Include=”SQLitePCLRaw.bundle_green” Version=”2.0.5-pre20210521085756″ IncludeAssets=”none” />   Once done, in

Uno Platform 3.9: .NET 6 Mobile, VS 2022, WinUI, plus XAML trimming for 50% Wasm AOT size reduction

The newest release brings support for .NET 6 (for iOS, Android, mac Catalyst and macOS), support for Visual Studio 2022 templates, WinAppSDK 0.8.1, Focus management updates, a XAML Trimming feature to reduce the size of WebAssembly apps by nearly 50% as well as many other improvements and bug fixes. WinUI Everywhere In order to follow through on our vision to make WinUI-built applications everywhere, we remain in lockstep with all advancements in Windows developer ecosystem. As Microsoft announced, WinUI 3 now ships as part of the new WinAppSDK (formerly known as Project Reunion). WinAppSDK 0.8.1 has been released and our 3.9 release supports it.   .NET 6 support – iOS, Android, macOS Catalyst and macOS Adding support for .NET 6 mobile targets required a significant effort in terms of packaging to ensure that both current Xamarin (iOS/Android/macOS) targets are supported, as well as new .NET 6 based targets. This new support is available for both Uno.UI and Uno.WinUI packages, ensuring a smooth transition for existing projects. .NET 6 Mobile for Uno Platform support comes with iOS, Android, macOS (AppKit) and Catalyst targets. Mac Catalyst is the newest platform addition, giving the ability for UIKit-based apps to run on macOS with

Hosting Uno Platform WebAssembly apps on Azure Static Web Apps

This article covers : Creating a GitHub repository and cloning it using Visual Studio. How to create an Azure Static Web App and configure it to pull from your GitHub repository. Creating an Uno Platform WebAssembly application and committing it to your repository. Note: A shorter Version of this article for those with more experience with Azure is available here in Uno Platform’s documentation. Suppose you have an idea for an Uno Platform WebAssembly application and you’re also thinking about how you could host it. In the past you may have used CDNs (Content Delivery Networks) for things like JavaScript libraries because the network distributes the files around the world. Being distributed around the world, the files are physically closer to your users which speeds up a browser’s request for the file compared to if the file was served from a single server on the other side of the world for example. Because an Uno Platform WebAssembly application is all client-side (all the work happens in the browser), what you have is a static web app. While you could host your static web application with a traditional hosting service, that would limit its potential. That’s because one of the main

Uno Platform 3.7 – More WinUI, Project Reunion and Linux Support, Wasm Performance Boost

Uno Platform 3.7 expands our support for the newest WinUI, Project Reunion and Linux, all while continuing performance improvements for WebAssembly head. Extending WinUI Support We are continuing the #WinUIEverywhere path by adding support for XAML behaviors for the newly-released WinUI 3. XAML Behaviors is an easy-to-use means of adding common and reusable interactivity to your Windows applications with minimal code. With Uno Platform, you can take it to any mobile, web or desktop platform. Previously, we provided support for XAML Behaviors for Windows UWP applications, and we have now been upgraded it to support Windows WinUI and Uno Platform applications as well. We also contributed the Prism Library support for Uno Platform and Project Reunion – WinUI 3. This was merged very recently in the preview bits and will be available as part of the next release. Big thanks to Dan Siegel and Brian Lagunas for their support to get this massive PR merged (200+ files changed!). New WinUI Control ported – SwipeControl The SwipeControl is part of the WinUI 2 library, and is used a lot on touch devices. We ported this control to Uno Platform to enhance the user experience of your apps: GTK/Linux TextBox support By

The State of WebAssembly – 2020 and 2021

With the start of a new year, it’s common to reflect on what happened over the past year and plan for the upcoming year. In this article, I’m going to look at the state of WebAssembly in 2020 and where I see things going this year. Before we jump in, for those of you who may be unaware of what WebAssembly is, I’ll give you a quick primer. What is WebAssembly? WebAssembly, which you might also see abbreviated as Wasm, is a low-level assembly-like language that is designed to be safe, fast, compact, portable, and a compilation target. That’s a bit of a mouthful but, basically, it’s not designed to be written by hand. You use a higher-level language and compile to it. The files are designed to be as small as possible so that they can be transferred and downloaded quickly. They’re also structured in such a way as to optimize validation and parsing so that the module can start up as quickly as possible. From the beginning, the desire was to be able to use WebAssembly modules outside the browser as well but the initial work was in the browser. Regardless of where they’re used, you need to

How To Build A Single-Page Web App in XAML and C# with WebAssembly Using Uno Platform

Single-page web applications (SPA) provide faster transitions and interactivity that make a web application feel like a native app. It has become a popular style of developing web applications with JavaScript frameworks like React, Vue, or Angular. In a SPA, all the resources needed for the web app to be functional are loaded the first time the app is loaded, or some of it dynamically loaded. Unlike a server-rendered web application where some user interactions go to the server to retrieve the required markup and data, there’s no page reload in a SPA. Although the browser location history can be updated dynamically to provide the perception that the user is taken to a new page. In this post, you’ll learn how to build a SPA using Uno Platform, C#, and XAML. As a pre-requisite, you should have some knowledge of C#, XAML, Uno Platform, and WebAssembly. You should also have set up your development environment for building with Uno Platform. If you haven’t, take some time to read the first two sections of a previous post on how to do this. Project Set-Up The sample app we’re going to build will be a basic app with a header, and a

Blazor WebAssembly (client-side) with AOT and SkiaSharp

As we’re working to stabilize our .NET 5 support for Uno Platform, and particularly Full AOT and Profile Guided AOT, it seemed natural to experiment and validate if the work we’ve been doing could also benefit Blazor. There is always something we learn when we experiment and help push the WebAssembly toolchain forward, so top-notch tooling is available as soon as possible. It turns out that enabling AOT and native linking in Blazor WebAssembly (client-side) can work, producing as you’d expect, some great performance benefits! If you are like us and like to experiment with WebAssembly, read on to see how we turned AOT on for Blazor WebAssembly. Here it is running on our server. Make sure you run the sample more than once, just to also experience the performance difference you get with initial load vs cached WebAssembly applications. https://blazor-aot.platform.uno/   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.     We’ve built a simple sample “File New Project” template

Uno Platform 3.2: .NET 5, C# 9 support and .NET 5 WebAssembly AOT Support

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