Skip to content

.NET 9 release notes

Rolf Bjarne Kvinge edited this page Nov 8, 2024 · 7 revisions

We're excited to announce our .NET 9 SDK release!

Note: these are the base SDKs that add support for the platforms in question, if you are looking for .NET MAUI (which is built on top of our SDKs), go here instead: https://docs.microsoft.com/en-us/dotnet/maui/.

Getting Started | What's New | Known Issues | Feedback | FAQ

Versions

This release consists of the following versions:

Requirements

It's highly recommended to use Xcode 16.0+ (which requires macOS 14.5 (Sonoma) or macOS 15.0 (Sequoia). Earlier versions of Xcode may work, but some features won't be available.

With the release the minimum supported OS versions can be targeted for apps:

  • iOS: 12.2
  • macOS: 12
  • tvOS: 12.2
  • Mac Catalyst: 15.0

Note: while we support macOS 12, we're only testing on OS versions that Apple supports. At the time of this writing this means we're only testing on macOS 13+.

Getting started

The first step is to getting started is to install .NET 9.0.100 (or later).

Then install the workload corresponding with the desired platform:

$ dotnet workload install ios # other workloads: macos, tvos, and maccatalyst

Create new app from a template with:

$ dotnet new ios # 'dotnet new --list --tag Mobile' will show all available templates

Finally build and run the new app in the simulator

$ dotnet run

What's New in this Release

This release contains SDKs for the following four platforms: iOS, tvOS, Mac Catalyst and macOS, and has support and bindings for the OS versions that were shipped with Xcode 16.0:

  • iOS 18.0
  • macOS 15.0
  • tvOS 18.0
  • Mac Catalyst 18.0

What's Changed

NativeAOT

In .NET 8 we released experimental support for NativeAOT, and we're now happy to announce that starting in .NET 9, NativeAOT is fully supported.

Our initial testing shows significant improvements both in size (up to 50% smaller) and startup (up to 50% faster), so we're encouraging developers to try it out and report back their findings.

More information about our NativeAOT support can be found here.

Trimming warnings

We've fixed all the trimming warnings in our SDK, which means it's now possible to enable trimming warnings without getting a lot of noise. In fact, we've enabled trimmig warnings by default already when NativeAOT is enabled.

In order to always trimming warnings if NativeAOT is not enabled, add this to the project file:

<PropertyGroup>
    <SuppressTrimAnalysisWarnings>false</SuppressTrimAnalysisWarnings>
</PropertyGroup>

Note: this will still raise numerous warnings if no assemblies are trimmed with MtouchLink=None or TrimMode=copy.

Type registrar: managed-static as the new default

In .NET 8 we introduced a new type registrar: managed-static primarily for supporting NativeAOT runtime. Due to the performance benefits that it brings, in .NET 9 we are enabling managed-static to be the new default registrar for all supported runtimes affecting the following configurations:

  • iOS and tvOS device builds in all configurations
  • macOS and MacCatalyst builds in release configuration

NOTE: simulator builds are not affected

Opting-out

Even though the new registrar is typically faster, it can also negatively impact the application size. Based on preliminary testing the size regression of a template MAUI iOS application with Mono varies between 2-3%.

For customers, for whom application size is critical, it is possible to opt-out from using the new default by adding the following MSBuild target to your project file:

<Target Name="SelectStaticRegistrar" AfterTargets="SelectRegistrar">
    <PropertyGroup Condition="'$(Registrar)' == 'managed-static'">
        <Registrar>static</Registrar>
    </PropertyGroup>
</Target>

New Contributors

Full changelog

Full Changelog: https://github.com/xamarin/xamarin-macios/compare/dotnet-8.0.1xx-xcode16.0-8314...dotnet-9.0.1xx-xcode16.0-9617

Unsupported TargetPlatformVersion is now an error instead of being ignored.

We support a few TargetPlatformVersion values (the optional OS version at the end of the TargetFramework - for instance for net9.0-ios18.0 the TargetPlatformVersion would be 18.0), but in the past we've ignored any unsupported values, and just fallen back to the latest supported version.

In .NET 9 using an unsupported TargetPlatformVersion will become an error instead. While the error message will list the valid versions, typically it's best to not put a version at all, and then we'll automatically pick the latest (and it won't be necessary to update in the future).

Known Issues

See Known issues in .NET 9.

Feedback

File issues here: https://github.com/xamarin/xamarin-macios/issues/new.

Clone this wiki locally