MAUI Vs. Xamarin
To Start, What is .NET MAUI?
In November 2020, Microsoft previewed its new Mobile Application User Interface (MAUI), intended as a replacement for the Xamarin framework. Generally speaking, the Xamarin framework would serve as the bones for MAUI, with the new system being the recommended and actively developed cross-platform development framework from Microsoft. The last true Xamarin release is currently scheduled to leave active support and development this year.
The real differences with Xamarin vs MAUI are mostly under the hood and development related. It advertises better performance, and a simpler cross platform design paradigm with fewer platform specific customizations and behaviors required.
Starting a .NET Maui Project
We recently had a mobile app development project kicking off with a client who is very bought into the Microsoft environment, which mean we were planning to use Xamarin. During the sales and planning process, MAUI was released and began being promoted as the future of mobile web development for Microsoft. Because the client was planning to maintain and extend the app into the indefinite future, we agreed that moving to the new paradigm was the right decision for the long-term future of the application.
At the time, MAUI was the new hotness, and the differences of MAUI vs Xamarin were just beginning to be described and the .NET MAUI Documentation was being developed, with a lot of changes coming. Most of the online resources still used the Xamarin patterns as the baseline, which is honestly still true today. Nonetheless, because the MAUI framework was the future supported framework for .NET cross platform development, we, in consultation with the client, forged ahead on using MAUI for their mobile application.
Growing Pains: Our Experience Writing a .NET MAUI App
.NET MAUI Documentation
.NET MAUI Controls
Another set of issues we encountered was around the MAUI controls library. The client had a third-party controls library they used for enhanced controls, but we also used many of the included controls for the user interface. One of the things we discovered early on was that even the major control venders were still getting up to speed on how to work with MAUI. We experienced one major bug that prevented us from updating the third-party control library for several months, despite the working version we were on being marked out of date and undeployable on newer systems.
In addition to those controls, we also encountered a number of ‘known issues’ such as the z-index layering of controls not working on some devices. These issues caused time consuming rewrites to work around, even if they were fixed by new versions released later in the project.
Installing .NET MAUI Components
The final category of pain points working with MAUI was the installation of components and getting everything to work together. This wasn’t difficult or broken, just time consuming. The first item every member of the team, both on our side and the client’s, had to reinstall the entire toolchain multiple times, including Visual Studio and Xcode.
Updates to any of the pieces became fraught with uncertainty, as it was more likely than not that a simple upgrade would cost hours of lost development time as systems were reconfigured.
In Review: Should We Have Gone with .NET MAUI vs Xamarin?
At the end of the day, the project was successfully completed with MAUI despite the setbacks and extra time required. Most of the issues were resolved either by changing our patterns to avoid the problem, or simply spending extra time to work through the difficulties.
In retrospect, it’s clear that MAUI was not ready for a production build for our client. Just as clearly, however, building out a brand new application in an out of date .NET framework would have been a waste of resources.
While it’s clear the most efficient solution would have been to wait until MAUI had the kinks worked out, it rarely makes business sense to wait. If we had started the project today, it would have taken less time to complete.
MAUI vs. Xamarin, Revisited
Overall, MAUI does represent a marked improvement over the old Xamarin framework. Unlike previous Xamarin projects, we wrote almost no custom platform code, with the only difference being our error handling of last resort needing to be different across the two projects. The vast majority of the issues we experienced were resolved by the framework over the course of development, or else we were able to devise UI patterns to avoid them entirely.
Should you use MAUI for your next project? Absolutely! If you’re looking for a solid cross platform framework using the popular .NET language, .NET MAUI is the way to go. We were able to integrate it with our back end easily and share front-end business logic and design patterns with other front end application. The fact that the front end and back end were all written in C# was another major advantage for the team, as it didn’t require the client’s development team to learn a new language just to support the front end of a mobile app.