Announcing .NET MAUI in .NET 8
Today our team is thrilled to introduce you to the latest major stable release of .NET MAUI in .NET 8! We build .NET MAUI to enable .NET developers to create cross-platform applications for Android, iOS, macOS, and Windows with deep native integrations, platform-native user interfaces, and hybrid experiences that extend the reach of Blazor and other web UI technologies. Today marks the third major release of .NET MAUI in the past 18 months which turns the corner from our unifying of the Xamarin platform with .NET into pushing forward .NET as one.
In addition to all the amazing work in the .NET SDK and runtime, we have labored with extreme focus on .NET 8 to fix high impact bugs, isolate and resolve memory leaks, improve the accuracy and reliability of hot reload, ease the path for customers upgrading from Xamarin, retain and improve performance at startup and runtime, and so much more. We are very proud of this release and cannot wait for everyone to start using it.
“Creating Right to Left layouts in .NET MAUI is now a reality thanks to .NET 8. Visual elements are perfectly arranged and Carousels work great now. We’ve been working with the latests preview bits for a while and the improvements the MAUI team did have proven key to successfully deliver RTL apps to our clients.” – Leo, UXDivers for Umrahme
Early feedback like this has been encouraging, and we are eager to hear from you next. Let’s take a look at some of the biggest improvements you’ll get in .NET MAUI.
Firstly looking at the release by the numbers, in .NET 8 we have:
- 1618 pull requests merged (up from 577)
- 689 bug issues resolved (up from 180)
Compared to the .NET 7 GA release that’s a 180% increase in pull requests merged and 283% more bug issues resolved. Since .NET 7 was a shorter release for .NET MAUI, I thought it would be interesting to include all the .NET 7 service releases as well. Taking that into account, .NET 8 still has 18% more pull requests merged and 13% more bug issues resolved.
This would not have been possible without the 94 wonderful contributors across teams at Microsoft and especially from the community. On behalf of all .NET MAUI users we thank you so much for your continued contributions and support!
Early in .NET 7 servicing we heard loud and clear from developers that we needed to raise the quality of releases, and so we did just that raising the bar on what we would backport from our .NET 8 work to release in .NET 7 until we had more automated testing in place and other processes to better guard against this. During subsequent releases we enabled a dormant suite of Xamarin.Forms tests to run on .NET and against .NET MAUI, and added more than 3500 device tests on Windows spread across the Controls, Core, and Essentials areas among other tests.
Going forward in .NET 8 servicing, the bar is back down and we will ship more bug fixes to .NET 8 than you saw in .NET 7. We know that this was not a popular decision, and we did the work to be more confident in the quality of our quick servicing releases to meet your need.
The top areas of quality improvements are:
- Keyboard behavior, especially on mobile
- FlowDirection support for right-to-left languages
- Layout fidelity and performance
- Scroll performance
- Memory management
Visit the release notes for a complete list of fixes and improvements.
The .NET MAUI pedigree is rooted in touch interfaces on mobile and tablet devices, so we have some work to do to enable more desktop specific experiences where user input is more often from keyboard and mouse. This release enables keyboard accelerators, enhances pointer gestures, and more.
A keyboard accelerator is the shortcut you can associate with any menu item in a desktop application, like copy (Ctrl+C), paste (Ctrl+V), and Cut (Ctrl+X).
<ContentPage.MenuBarItems> <MenuFlyoutItem Text="Cut" Clicked="OnCutMenuFlyoutItemClicked"> <MenuFlyoutItem.KeyboardAccelerators> <KeyboardAccelerator Modifiers="Ctrl" Key="X" /> </MenuFlyoutItem.KeyboardAccelerators> </MenuFlyoutItem> </ContentPage.MenuBarItems>
For more details and advanced examples, see the Keyboard Accelerators documentation.
Pointer gesture enhancements
.NET MAUI has included a
PointerGesture for a while so you knew when the cursor was over an element, and now in .NET 8 you gain
PointerReleased events along with event arguments containing more information about the position of the pointer. This works across Android, iPadOS, Mac Catalyst, and Windows.
See the updated Recognize a pointer gesture documentation.
Drag and drop gesture enhancements
To improve the drag and drop user experience we have exposed more APIs on Windows such as including custom glyphs when you initiate a drag, custom captions when you drag, and on iOS and Mac Catalyst for the size of the item you’re dragging, adding custom shapes or images, and customizing the drop actions to indicate if it’s a copy, a move, or a forbidden action.
See the updated Recognize a drag and drop gesture documentation.
Performance and memory improvements
Jonathan Peppers has written in-depth about the work in .NET 8 to improve performance, app size, and address memory leaks. New features include AndroidStripILAfterAOT, AndroidEnableMarshalMethods, and NativeAOT for iOS. These and many other improvements are available so you can choose the best path for reducing your app size and improve performance.
By staying on the leading edge of .NET, you get most of these improvements without having to make any changes to your code.
With the enormous amount of work that has gone into this release, it should be no surprise that there’s even more to highlight. For the complete list of changes, enjoy a lengthy read of the .NET MAUI 8.0.3 release notes, and for an abbreviated summary enjoy reading the What’s new in .NET MAUI for .NET 8.
- Publish an unpackaged .NET MAUI app for Windows with the CLI.
ContentPage.HideSoftInpuOnTappedto dismiss the keyboard when tapping anywhere on the page
- Controls that support text input gain extension methods that support hiding and showing the soft input keyboard. For more information, see Hide and show the soft input keyboard.
- WebView gains a UserAgent property. For more information, see WebView.
- Inline media playback of HTML5 video, including autoplay and picture in picture, has been enabled by default for the WebView on iOS. For more information, see Set media playback preferences on iOS and Mac Catalyst.
- BlazorWebView gains a StartPath property, a TryDispatchAsync method, and enhanced logging capabilities. For more information, see Host a Blazor web app in a .NET MAUI app using BlazorWebView.
- The TapGestureRecognizer class gains the ability to handle secondary taps on Android. For more information, see Recognize a tap gesture.
Get started today
.NET MAUI and .NET 8 are included in today’s stable release of Visual Studio 2022 17.8.
Download the .NET 8 installer, and then install .NET MAUI from the command line:
dotnet workload install maui
Through the retirement of Visual Studio for Mac next year you can continue developing using Visual Studio for Mac after enabling the preview feature for .NET 8 in Preferences.
For upgrading projects to .NET 8, follow the upgrade guidance on our wiki.
On behalf of the .NET MAUI team, thank you for all of your engagement, contributions, and support! We look forward to hearing about your successes, and your feedback on how we can improve the product through .NET 8 service releases and into .NET 9.