WebAssembly

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

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

WebAssembly tools, frameworks, and libraries for .NET Developers

WebAssembly provides a way to run code written in multiple languages on the web at near-native speed, with client apps running on the web that previously couldn’t have done so. This is why it’s gaining quick adoption and more awareness in the web community. Using the WebAssembly JavaScript APIs, you can load WebAssembly modules into a JavaScript app and share functionality between them. This blog post is a part of the Introduction to WebAssembly for .NET Developer Series on Uno Platform blogs For you as a .NET developer, this means you can write code in C# and run it in the browser. This can be libraries that you can compile into a WebAssembly module or an app built entirely using C#. Using .NET for client-side WebAssembly development offers advantages such as: – Leverage the existing .NET ecosystem of .NET libraries. – Benefit from .NET’s performance. – Stay productive with the same tools you use for Web or Desktop development on Windows, Linux, and macOS. – Build on a common set of languages, frameworks, and tools that are stable, feature-rich, and easy to use. In this post, I’ll share with you different tools and libraries that you can use to build

Introduction to WebAssembly for .NET Developers: Building with Uno Platform, XAML, and C#

In a previous post on WebAssembly, we briefly introduced the concept of WebAssembly and what framework/library you need to build WebAssembly apps with .NET. This post will be more practical. I’ll show you how to build a web application utilizing WebAssembly with .NET, XAML, and C#. You’ll build a simple XAML app with some form controls to collect data and display that data in a ListView. Here’s how the app you will build will look like: Guest post by Peter Mbanugo. At the end you’ll learn: – How to create a WebAssembly .NET project. – How to deploy the web app. – Set up your computer for WebAssembly app development with .NET Core and Uno platform. In order to easily follow along, you need to have some knowledge of C# and either XAML, Windows Forms, or WebForms, but I’ll be chiming in with some context so that even if you’ve never worked with XAML, you can easily follow along. Project Set-Up You can build Uno platform apps for WebAssembly, Windows, Linux, macOS, and the different mobile OS. The setup is different for each platform but I’ll detail the steps for creating an Uno project using both Visual Studio and VS

Beautiful WebAssembly Charts courtesy of Syncfusion and Uno Platform

A few weeks back Syncfusion announced their UWP Charts now support Uno Platform and run on WebAssembly. We’ve worked together with Syncfusion team to make this a reality. As this happened just during the UnoConf timeframe, these important news might have gotten lost in the buzz of announcements we made – support for Linux, experimenting with Tizen, Material and Fluent out of box support etc etc. So with this blog we simply want to surface out these beautiful line-of-business charts you can use in WebAssembly today. After all, what is a great looking LOB application without some pretty and interactive charts – right? Syncfusion has released thirteen charts compatible with WebAssembly – see them in action below. We’d also love to hear from you about which should be the next control we work on together with Syncfusion – drop by Uno Platform channel at UWP Discord community to let us know. Currently thirteen charts are supported: Column chart Bar chart Line chart Spline chart Area chart SplineArea chart Scatter chart Bubble chart Pie chart Doughnut chart Semi pie chart Semi doughnut chart Stacked doughnut chart For detailed steps on how to embed these charts in your solution please see Syncfusion

Using WebAssembly Modules in C#

This article covers Implementing custom module validation in an ASP.NET Core MVC web application Using Emscripten to create a WebAssembly module that can be used outside the browser Using WebAssembly modules in your C# code Imagine you’re working for a company who’s about to build a web application for expense reimbursements. Before they do, they task you with building a prototype to evaluate several things including if WebAssembly can be leveraged both on the client in JavaScript and on the server in C#. For the prototype, you’ll create an ASP.NET Core MVC web application. The MVC application has good built-in validation but the final product will need some additional custom validation. For the prototype you’ll keep the validation simple because you just want to know if it’s possible to use WebAssembly in both the browser and in the C# code. The following image shows the two web pages that you need to build for this prototype: For this prototype, you’re going to implement WebAssembly validation in the JavaScript for the Amount field and in C# for the Description field. Validation is performed in the browser primarily so that a web application is more responsive to the user’s actions. For example,

Top 5 WebAssembly Use Cases for .NET Developers

If you are an enterprise software developer, WebAssembly probably crosses your news feeds frequently. Usually the use cases are related to games – someone has ported Doom3 or the Flight Simulator, or some performance improvement over a JavaScript library, which may create the illusion WebAssembly is ‘not meant for you’. The reality couldn’t be more different. If you are not paying attention to WebAssembly – you should. The adoption rate is accelerating and WebAssembly is shifting from being relatively unknown technology to mainstream technology as we speak. Below is the list of use cases we come across most often when talking to our customers and community, and sometimes those use cases are even interlocked. 1 – Greenfield Development – Multi-Platform Development Of the five scenarios, this is the most frequent one. You’ve been tasked to develop an app that ‘runs everywhere’ – desktop, mobile, web. Good news for you – no luggage to carry forward, it is a net new app and there is no old code base to consider. A dream job, really. Naturally, no other deployment mechanism will beat the web. However, you are not a fan of JavaScript. WebAssembly to the rescue! As of last year, W3C

Working with SQLite and WebAssembly for .NET Developers

With recent updates of the mono runtime, and the reactivity of the .NET team to fix issues, it’s now possible to use SQLite with the Uno WebAssembly Bootstrapper and Uno Platform apps.This support is now enabled through WebAssembly static linking, and the reuse of LLVM bitcode compiled source, such as SkiaSharp or SQLite. It allows for an easy use of code written in other languages, from an app built with C#. With the Erik Sink’s recent updates to SQLitePCLRaw 2.0, it’s now possible with .NET for WebAssembly to use the existing official packages. This also enables Entity Framework Core 3.1, and Frank Krueger’s SQLite-net to work out of the box without any specific configuration for WebAssembly. About Uno Platform For those new to Uno Platform – it enables for creation of single-source C# and XAML apps which run natively on iOS and Android, macOS and Web via WebAssembly. Uno Platform is Open Source (Apache 2.0) and available on GitHub. To learn more about Uno Platform, see how it works, or create a small sample app.   Client-side SQLite and Entity Framework Core In order to demonstrate the use of client-side only technologies in the browser, we’ve updated our SQLite 3.3 + EFCore 3.1