This article is more than 1 year old

Last stop before MAUI: Xamarin Forms 5.0 released for cross-platform mobile, new features, new bugs

Microsoft's cross-platform .NET tools get a refresh, but with a relatively short life before newer tools sweep it away

Microsoft has flung open the doors to Xamarin Forms 5.0, a major new version of its cross-platform framework targeting iOS, Android, and Windows 10.

Other target platforms such as macOS and WPF (Windows Presentation Foundation) are in varying degrees of readiness.

However, the company stated that the forthcoming Multi-platform App UI (MAUI) will replace Xamarin Forms, so jumping in now is only worth it for developers who plan a MAUI migration later.

The first release of Xamarin Forms was in 2014 when Xamarin was still an independent company. The firm's technology, based on the Mono open-source implementation of the .NET Framework, included C# compilers for Android and iOS.

The company's original line was that only non-visual code should be cross-platform, and developers were asked to create a native user interface for each target platform. While good for native look and feel, this approach is a lot of work, and Xamarin Forms was introduced in 2014 to enable basic user interface code to be shared across platforms. It was taken up with enthusiasm by Xamarin developers, and subsequent releases increased its scope. The firm was acquired by Microsoft in 2016.

Back in 2016, it looked as if Xamarin and Xamarin Forms might be important for Microsoft and for the .NET ecosystem. The ability to write .NET code and run it on mobile as well as desktop platforms seemed to solve a big problem for the company. Within Microsoft, though, it was one of many development options, with the Windows team putting its weight behind the Windows 8 Modern platform, which evolved into UWP (Universal Windows Platform) as well as JavaScript-based cross-platform options.

There were also some annoyances with Xamarin Forms, including the fact that the XAML dialect it uses is different from that used for Silverlight and WPF. UWP was added as a target platform for Xamarin Forms, but it still had gaps, such as Windows Desktop and macOS (announced in early 2017 but still in preview).

Another point of confusion is that the variant (or, more accurately, variants) of .NET used by Xamarin Forms is different both from the Windows-only .NET Framework and from the open-source .NET Core.

Xamarin Forms will converge with .NET Core with the release of .NET 6.0, whereupon it will be evolved into MAUI.

According to Scott Hunter, Microsoft Director, Program Management, MAUI will provide "a single stack that supports all modern workloads: Android, iOS, macOS, and Windows."

Thanks to Blazor and WebAssembly, there may eventually be web application support as well.

Hunter also revealed that the newly released Xamarin Forms 5.0 will have a short life. "Xamarin.Forms will ship a new major version later this year, and continue to ship minor and service releases every 6 weeks through .NET 6 GA in November 2021. The final release of Xamarin.Forms will be serviced for a year after shipping, and all modern work will shift to .NET MAUI," he said.

Version 5.0 is the "new major version" he was referring to, and active support for Xamarin Forms (any version) is scheduled to end November 2022, according to the MAUI notes on GitHub.

The transition from Xamarin Forms to MAUI should be smooth, but will nevertheless be a migration and not just a recompile of the source. "We intend to provide try-convert support and migration guides similar to what we have today for migrating to .NET Core," said Hunter.

While the above means that Xamarin Forms 5.0 is at best a transitional release, it is something that developers enthused by the prospect of MAUI can use now. Google's Flutter is an obvious competitor, but has a different philosophy, drawing its own user interface controls rather than using what is native to the platform it runs on. The merits of this approach are eternally debated, but for developers who prefer to render the UI using native controls, Xamarin Forms is an attractive solution.

5.0 has a bunch of new features, including support for app themes such as Dark Mode, Brush classes for painting an area, new Shapes and Paths for drawing, more sophisticated radio buttons including control templates for rich effects, and a SwipeView container for menus revealed by a swipe gesture. Drag and drop gestures are also now supported, subject to a minimum version of iOS 11 on Apple's mobile platform.

A new CarouselView is for displaying a collection of items that the user can swipe through. Developers targeting iOS are being asked not to use the UIWebView control, which has been replaced by a WKWebView control; Apple has deprecated UIWebView. Further, some elements which used to be in the core Xamarin Forms framework have been moved to a Community Toolkit library. This includes MediaElement and Expander. Some "experimental" packages including DataPages and Themes have been removed from the framework.

Users commenting on the post introducing Xamarin Forms 5.0 have noted some problems with the first release. "There are many Bugs and Issues related to Right To Left Layout," said one. Another "ran into two pretty obvious issue[s] with Shell. The first is that if you have a Shell.FlyoutBackgroundImage it is shown on top of the menu items such that they are not visible. The second is that Shell.TitleView is not shown at all in iOS."

David Ortinau, Microsoft principal program manager for mobile tools, responded that "those issues are both addressed and shipping very soon in a service release," but the existence of such issues suggests caution in adopting the new release immediately.

Master-detail forms are now renamed Flyouts for reasons of sensitivity - as well as being, according to Ortineau, a more accurate name.

Despite all the caveats, Xamarin Forms is a fast route for getting an existing .NET application ported to a mobile application. ®

More about


Send us news

Other stories you might like