Announcing .NET MAUI Preview 9

David Ortinau

.NET Multi-platform App UI (MAUI) Preview 9 is available today with .NET 6 RC2 and in the preview channel of Visual Studio 2022 Preview 5. While much of the work in this preview is focused on completing and stabilizing the 50+ controls and layouts, preview 9 adds support for borders, corners, and shadows across most all controls and layouts. Preview 9 includes performance improvements to help Android apps start instantly.

Roadmap news: as Scott Hunter shared last month, .NET MAUI will continue releasing previews monthly as we make our way to a release candidate (RC) in the first quarter of 2022, and general availability (GA) in the second quarter of 2022.

Updated Controls

New in this release are updated implementations of several controls. BoxView is a simple yet flexible and adaptive view that is useful for many needs. IndicatorView pairs with any collection based control to display an index of pagination using any shape you need. ImageButton is perfect for what you need a button that is just an image. WebView uses the platform native browser control to render any online or embedded HTML content; ideal for displaying markup more complex than the subset of HTML supported by Label.

More information:

Borders, Corners, and Shadows – Oh my!

The new Microsoft.Maui.Graphics library provides a consistent UI drawing API based on native graphics engines, and enables us to easily add borders, corner rendering, and beautiful shadows to most any layout or control in .NET MAUI.

border image

The new Border control can wrap any layout or control to add borders and independent control of each corner. This controls is provided in the style of WPF, UWP, Silverlight, and the latest Windows App SDK. In this example I have wrapped a border control around the counter label in our default template to add the stroke and round the top-left and bottom-right corners.

<Border 
    Grid.Row="2"
    Padding="16,8"
    Stroke="{StaticResource PrimaryBrush}"
    Background="#2B0B98"
    StrokeThickness="4"
    HorizontalOptions="Center">
    <Border.StrokeShape>
        <RoundRectangle CornerRadius="40,0,0,40"/>
    </Border.StrokeShape>
    <Label 
        Text=".NET MAUI Preview: 9"                
        FontSize="18"
        FontAttributes="Bold"
        TextColor="White"
        x:Name="CounterLabel" />
</Border>

The corner radius of the provided shape accepts a Thickness type value which enables independent control of each corner of the rectangle: top-left, top-right, bottom-left, bottom-right.

The border control does add a wrapping view element around a single content, so you can set a background color or padding as needed. Several other properties are available to customize the stroke of the border such as:

  • StrokeDashArray: pattern of dashes and gaps in the stroke
  • StrokeDashOffset: distance within the dash pattern
  • StrokeLineCap: shape at the end of a line
  • StrokeLineJoin: type of join at the vertices
  • StrokeMiterLimit: limit on the ration of the miter length to half of the stroke thickness

In a future version we’ll investigate adding a markup helper for setting the stroke shape directly rather than instantiating a shape.

shadow image

Ready to add some depth to your UI? Add a Shadow to any layout or control, including images and shapes.

<Image>
    <Image.Shadow>
        <Shadow Brush="#000000" 
                Offset="20,20"
                Radius="40"
                Opacity="0.8"/>
    </Image.Shadow>
</Image>

Quick Android Startup

Ahead-of-time (AOT) compilation makes a big difference in how quickly your applications can code start on Android. Full AOT may also make your application artifacts larger than you wish if you’re working to remain below the wifi installation bar. In this situation, Startup Tracing is the answer. By partially AOT’ing only the parts of your application executed during startup (by tracing the path of startup execution, hence the name), we are able to balance speed and size.

Preview 9 now ships with a .NET MAUI startup tracing profile, and can be used when building from command line.

Benchmark numbers from Pixel 5 device tests:

[Android App][1] [.NET MAUI App][2]
JIT startup time (s) 00:00.4387 00:01.4205
AOT startup time (vs. JIT) 00:00.3317 ( 76%) 00:00.7285 ( 51%)
Profiled AOT startup time (vs. JIT) 00:00.3093 ( 71%) 00:00.7098 ( 50%)
JIT .apk size (B) 9,155,954 17,435,225
AOT .apk size (vs. JIT) 12,755,672 (139%) 44,751,651 (257%)
Profiled AOT .apk size (vs. JIT) 9,777,880 (107%) 23,210,787 (133%)

We have a pull request for making this the default profile for .NET MAUI applications built in release configuration.

Jonathan Peppers also found an additional 400ms improvement by optimizing the Android resource designer file.

Ecosystem Controls

DevExpress, Syncfusion, and Telerik have recently all shipped new sets of controls for .NET MAUI, and are making use of the powerful graphics support provided in Microsoft.Maui.Graphics.

vendor control images, Announcing .NET MAUI Preview 9

Get Started Today

First thing’s first, install Visual Studio 2022 Preview 5 and check .NET MAUI (preview) under the Mobile Development with .NET workload, and check the Universal Windows Platform development workload.

Now, install the Windows App SDK Single-project MSIX extension. Before running the Windows target, remember to uncomment the framework in the csproj file.

Ready? Open Visual Studio 2022 and create a new project. Search for and select .NET MAUI.

Visual Studio 2022 new project dialog, Announcing .NET MAUI Preview 9

For additional information about getting started with .NET MAUI, refer to our documentation.

If you are migrating a project from another preview, check out our migration notes in the dotnet/maui wiki.

Feedback Welcome

Visual Studio 2022 previews are rapidly enabling new features for .NET MAUI. As you encounter any issues with debugging, deploying, and editor related experiences, please use the Help > Send Feedback menu to report your experiences.

Please let us know about your experiences using .NET MAUI to create new applications by engaging with us on GitHub at dotnet/maui.

For a look at what is coming in future releases, visit our product roadmap, and for a status of feature completeness visit our status wiki.

44 comments

Discussion is closed. Login to edit/delete existing comments.

  • Domagoj Medo 0

    Is 400ms Jonathan Peppers found included in this or will that be extra time saved?

      • David OrtinauMicrosoft employee 0

        Each benchmark report should be looked at individually, and that 400ms was for that specific app and configuration. The impact of the change on another application and device will vary.

        That PR is included in this release. This comparison will show what’s in the release by commit. https://github.com/dotnet/maui/compare/6.0.100-rc.1.7…release/6.0.1xx-preview9

  • Plakhotnyi Andrii 0

    Does MAUI support transparent and multiple windows?

    • David OrtinauMicrosoft employee 0

      There is a branch that has some early multi-window support, and it’s on our roadmap to include for our GA release.

      As for window transparency, if the native platform supports it, then you will be able to do it in .NET MAUI.

  • Titus Thobias 0

    Is MAUI available in VS2022 RC? Or is it only in VS2022 Preview 5?

    • David OrtinauMicrosoft employee 0

      .NET MAUI is in the Preview 5 version of the VS22 release today, and will remain in the preview channel until it is GA in Q2 2022. I recommend liberal use of side-by-side installs until then.

  • eugene gordeev 0

    is it possible to install .net maui on gnu/linux and create android apps?

    • David OrtinauMicrosoft employee 0

      While it’s not a scenario we support right now, you may be able to stitch together the dependencies you need. This is geared more towards building for Linux, but might be a good resource to start. https://github.com/jsuarezruiz/maui-linux

  • John 0

    Hi David, this update appears to fix a large number of the WinUI issues I reported, well done to the team!

    Just a heads up, you linked to the wiki for migration notes from earlier previews, there isn’t anything to cover from preview 8 to 9. Ive had to make various changes to get a WinUI build working, and struggling to get iOS to build due to minimum iOS version requirements that appear to be ignoring the minimum set in the info.plist. Clearing it from info.plist and relying on the SupportedOSPlatformVersion in the project still fails to build with:
    The MinimumOSVersion value in the Info.plist (10.3.4) does not match the SupportedOSPlatformVersion value (14.2) in the project file

    Thanks, John

    • Rolf KvingeMicrosoft employee 0

      Regarding the Info.plist issue: what you’re doing should work, once you remove the MinimumOSValue value from the Info.plist, the SupportedOSPlatformVersion value from the project file will be used. If you file an issue here: https://github.com/xamarin/xamarin-macios/issues/new, and attach a build log, we’ll have a look and figure out what’s going on.

      • John 0

        Rolf, this is also on new maui projects, the info.plist doesn’t have a minimum os version.
        Can you at least just try the above? Im seeing the same results with new apps created with VS2022 Preview 6 too. This is in a Windows VM, restored back to a clean version without any other previews installed.

      • John 0

        Any update on this Rolf? VS2022 Preview 7 has the same issue, a new default Maui app cannot be deployed to iOS simulators due to the MinimumOSVersion error I reported above (quick refresher: the info.plist doesn’t contain a min OS version so the error is wrong). This is, again, on a restored Windows image and a fresh VS2022 install.
        We are unable to continue testing until this issue is resolved.

  • hamid 0

    Hello and thank you so much for improvements , but I regret to say that MAUI (like Xamarin.Forms) is disappointing and discouraging because of it’s poor support for Right To Left languages/Cultures. nearly most of problems and bugs related to Right To Left Layout/Languages which are mentioned in Github (Xamarin.Forms) , also exist in MAUI.
    According to the reputation of Microsoft company for it’s perfect products and considering the fact that Right To Left support has been implemented in all of it’s products(Like Winform , WPF , ASP.NET) , it is expected from the company to consider and implement Right To Left support fully in MAUI , if it wants to gain Worldwide Success for this Platform.
    Thank You.

    • John 0

      Hi Hamid, we support RTL languages in our apps with Xamarin.Forms, what issues are you experiencing?

  • Dmitriy Lapshin 0

    Hello David,

    Just followed steps from the document
    1. Install Visual Studio 2022 Preview 5 and check .NET MAUI (preview)
    2. Install the Windows App SDK
    3. Open Visual Studio 2022 and create a new project. Search for and select .NET MAUI.

    These steps do not produce user friendly results.
    – .NET MAUI App template that is available is old! We still see “Startup : IStartup”.
    – SDK Workloads not installed: Getting this error – NETSDK1147 To build this project, the following workloads must be installed: maui-android
    – When try to execute the proposed command “dotnet workload install maui-android” see this error message: “dotnet : It was not possible to find any compatible framework version”

    After spending all day fighting with this – I am at the point to postpone any “maui”-related development of our product until you have more stable and predictable tools and better documentation to follow. Just wonder – did your QR try to complete these exact steps on a “clean” system before publishing them? Very frustrating guys!

    • 成 刘 0

      me too!
      i like c# and maui,i tried every preview edition ,but i disappeared every time,i think microsoft is a great company ,their staff is brilliant too,they just did not pay effort to maui,maybe they have no belief on this project.

    • Asad Mehmood 0

      Same issue here.
      I tried on multiple PCs and spent multiple days every time a preview is released but there is a new regression/bugs every time. This time, after upgrading from preview 4.1, it cannot parse first line of AndroidManifest.xml with error “VersionCode 1.0 is invalid. It must be an integer value.”. If I change version code to “1”, it starts expecting “1.0”.

      • john prass 0

        I have this VersionCode 1.0 is invalid issue also. So frustrating.

        Hoping for a fix, or workaround, soon.

          • john prass 0

            Thank you.

    • Reinhard Schuerer 0

      – When try to execute the proposed command “dotnet workload install maui-android” see this error message: “dotnet : It was not possible to find any compatible framework version”

      I had this problem before as it started the x86 version of dotnet instead of the x64 and only the x64 supports these workloads.

      run dotnet –info to check if shows

      Version: 6.0.100-rc.2.21505.57
      and
      RID: win10-x64

      otherwise check if “C:\Program Files\dotnet\” is before “C:\Program Files (x86)\dotnet\” in the PATH environment variable.

    • David OrtinauMicrosoft employee 0

      All the results you report indicate that you have old .NET 6 previews remaining on your system. Please use Add/Remove Programs to remove all .NET 6 installs, and also remove old VS22 previews. Within your C:\Program Files\dotnet folder, verify and remove any 6.0.x files and .NET MAUI files that may remain (there shouldn’t be any anyway). Then after a reboot for good measure, try a fresh install of VS22 Preview 5.

      Yes, we tested the exact steps and yes on both clean and previously used environments. We are definitely still in previews and have some issues to work through.

      While this is preview 9 of .NET MAUI here, it’s effectively the second preview together with Visual Studio. I’m sorry it’s been frustrating for you, and I appreciate your willingness to give it a go! We’ll continue working through the issues.

      Please use the VS Feedback feature and report these issues as you encounter them so we can troubleshoot further together with other reports.

  • Tao Zuhong 0

    Context: VS 2022 Preview 5 + MAUI Preview 9 + NET SDK 6 rc.2

    Make a Maui app, then build and run, Exception thrown:
    ‘System.TypeLoadException’ in Microsoft.Maui.Controls.dll
    The program has exited with code 3221226107 (0xc000027b).

  • Steve Shaw 0

    Its not easy for me to judge how feature-complete Maui is, at each Preview Release, vs. Xamarin Forms.

    What would be great is a chart, similar to what is done for browser support at caniuse.com, where the functionality of X-Forms is taken as the ‘standard’, and it is shown how far along Maui is for each feature.

    Our X-Forms based app makes extensive use of available features, everything from OpenGL to custom renderers. What’s given us the most pain when debugging is data binding in our custom controls. I plan to test MVU as an alternative approach. But not until there is enough functionality to be worth my time in that experiment.

    — ToolmakerSteve

  • Pony Speed 0

    When targeting Windows 10 , it require your machine to be 2004 or later, I am using 1909. Is this decision final, or you will support earlier version of Windows 10 in later MAUI release ? FYI, the reason I am using 1909 is because I use vhd bootable windows 10, which can not upgrade to newer version, so I am going to stick to 1909 for a long time. VHD boot is great for developer or admin who need to try out different windows 10 config. For example, I created a 90G vhd os image just to try out this MAUI buiild, I can switch back to original vhd in a instant. Is there any technical reason why MAUI need newer version?

    Deployment error message :

    The package requires OS version 10.0.19041.0 or higher on the Windows.Desktop device family. The device is currently running OS version 10.0.18363.1500.

Feedback usabilla icon