Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support .NET 9.0 #2215

Open
wants to merge 153 commits into
base: main
Choose a base branch
from
Open

Support .NET 9.0 #2215

wants to merge 153 commits into from

Conversation

bijington
Copy link
Contributor

@bijington bijington commented Sep 18, 2024

Description of Change

Linked Issues

PR Checklist

  • Has a linked Issue, and the Issue has been approved(bug) or Championed (feature/proposal)
  • Has tests (if omitted, state reason in description)
  • Has samples (if omitted, state reason in description)
  • Rebased on top of main at time of PR
  • Changes adhere to coding standard
  • Documentation created or updated: https://github.com/MicrosoftDocs/CommunityToolkit/pulls

Breaking Changes

Major Breaking Changes

  • .NET 8 no longer supported
  • Stop automatically assigning Behavior.BindingContext
    • .NET MAUI Behaviors do not automatically inherit their parent's BindingContext (a breaking change from Xamarin.Forms)
    • Going forward, the .NET MAUI Community Toolkit will follow this implementation of Behaviors
  • Increase minimum supported OS versions of CommunityToolkit.Maui.MediaElement
    • Android 26.0
    • iOS 15.0
    • MacCatalyst 15.0
  • Increase minimum supported versions of CommunityToolkit.Maui.Camera to 15.0:
    • iOS 15.0
    • MacCatalyst 15.0

Minor Breaking Changes

  • Expander is not trim safe
  • ValidationBehaviors are not trim safe
  • CommunityToolkit.Maui.Maps is not trim safe
  • Remove PopupService.ShowPopop(TViewModel)
    • Removes [Obsolete] method
    • Use PopupService.ShowPopup<T>() instead
  • Remove PopupService.ShowPopopAsync(TViewModel, CancellationToken)
    • Removes [Obsolete] method
    • Use PopupService.ShowPopupAsync<T>() instead
  • Remove ability to subclass BaseConverter<TFrom, TTo>
    • Subclassing from BaseConverter<TFrom, TTo> is not supported
    • Support requires documentation and complete unit tests
  • Remove ability to subclass BaseConverter<TFrom, TTo, TParam>
    • Subclassing from BaseConverter<TFrom, TTo, TParam> is not supported
    • Support requires documentation and complete unit tests
  • ValidationFlags.ValidateOnFocusing renamed to ValidationFlags.ValidateOnFocused
  • ValidationFlags.ValidateOnUnfocusing renamed to ValidationFlags.ValidateOnUnfocused
  • In CommunityToolkit.Maui.Camera, add linker.xml for net9.0-android to avoid the Linker removing Xamarin.AndroidX.Camera.Core, Xamarin.AndroidX.Camera.Lifecycle, Xamarin.AndroidX.Camera.Video, Xamarin.AndroidX.Camera.View, and Xamarin.AndroidX.Camera.Camera2
  • public static Task<bool> ShowKeyboardAsync(this ITextInput, CancellationToken) -> public static ValueTask<bool> ShowKeyboardAsync(this ITextInput, CancellationToken)

Analyzer Benchmarks

.NET 9.0 RC2 Mean Error StdDev Median Gen0 Gen1 Allocated
VerifyNoErrorsWhenUseMauiCommunityToolkitMediaElement 11.20 ms 0.222 ms 0.545 ms 11.13 ms 62.5000 31.2500 1.56 MB
VerifyNoErrorsWhenUseMauiCommunityToolkitMediaElementHasAdditionalWhitespace 11.08 ms 0.220 ms 0.502 ms 11.06 ms 62.5000 31.2500 1.56 MB
VerifyErrorsWhenMissingUseMauiCommunityToolkitMediaElement 17.08 ms 0.816 ms 2.276 ms 16.15 ms 90.9091 - 2.38 MB
.NET 8.0 Mean Error StdDev Median Gen0 Allocated
VerifyNoErrorsWhenUseMauiCommunityToolkitMediaElement 9.763 ms 0.1928 ms 0.4765 ms 9.633 ms 31.2500 1.46 MB
VerifyNoErrorsWhenUseMauiCommunityToolkitMediaElementHasAdditonalWhitespace 9.565 ms 0.1862 ms 0.4637 ms 9.460 ms 31.2500 1.46 MB
VerifyErrorsWhenMissingUseMauiCommunityToolkitMediaElement 15.495 ms 0.3879 ms 1.0814 ms 15.058 ms 66.6667 2.24 MB

@hansmbakker
Copy link

hansmbakker commented Sep 18, 2024

The errors are because in https://github.com/CommunityToolkit/Maui/blob/feature/sl-dotnet-nine/azure-pipelines.yml the .NET SDK to install is

  • set to the LATEST_NET_VERSION variable instead of picking up the version from global.json
  • set to prevent using prereleases (both in global.json and in azure-pipelines.yml)

See

Maui/azure-pipelines.yml

Lines 73 to 78 in c4169ed

- task: UseDotNet@2
displayName: 'Install Latest .NET SDK, v$(LATEST_NET_VERSION)'
inputs:
packageType: 'sdk'
version: '$(LATEST_NET_VERSION)'
includePreviewVersions: false

Note that the UseDotNet@2 task can pick up global.json to read its settings from - I would recommend to define these SDK settings only in global.json and not redefining it in the pipeline as well.

Copy link
Collaborator

@brminnick brminnick left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for updating the Analyzer Unit Tests, Shaun! We can just remove the reference to Net80 since we won't be reverting back to .NET 8 after we update the library to .NET 9.

bijington and others added 2 commits September 19, 2024 20:23
…AnalyzerVerifier`1+Test.cs

Co-authored-by: Brandon Minnick <13558917+brminnick@users.noreply.github.com>
…CodeFixVerifier`2+Test.cs

Co-authored-by: Brandon Minnick <13558917+brminnick@users.noreply.github.com>
@bijington
Copy link
Contributor Author

The errors are because in https://github.com/CommunityToolkit/Maui/blob/feature/sl-dotnet-nine/azure-pipelines.yml the .NET SDK to install is

  • set to the LATEST_NET_VERSION variable instead of picking up the version from global.json
  • set to prevent using prereleases (both in global.json and in azure-pipelines.yml)

See

Maui/azure-pipelines.yml

Lines 73 to 78 in c4169ed

- task: UseDotNet@2
displayName: 'Install Latest .NET SDK, v$(LATEST_NET_VERSION)'
inputs:
packageType: 'sdk'
version: '$(LATEST_NET_VERSION)'
includePreviewVersions: false

Note that the UseDotNet@2 task can pick up global.json to read its settings from - I would recommend to define these SDK settings only in global.json and not redefining it in the pipeline as well.

Thanks for the suggestions. I know we have been discussing about migrating to GitHub actions so I will leave this with limited change for now

@brminnick
Copy link
Collaborator

This PR is blocked by dotnet/maui#25871.

We are unable to provide .NET 9 support to the .NET MAUI Community Toolkits until this issue is resolved by the MAUI engineering team.

@jfversluis
Copy link
Member

Pinged the team on this! But might not be until next week until we get the time to really look into it.

@brminnick
Copy link
Collaborator

brminnick commented Nov 15, 2024

Hey @JoonghyunCho! We're seeing Tizen build errors on this PR. Could you take a look?

error MSB4057: The target "TizenComputeTpkResourceFiles" does not exist in the project

https://dev.azure.com/dotnet/CommunityToolkit/_build/results?buildId=111570&view=logs&j=765bf613-0e88-5993-dfba-bef6ea201168&t=f10d855c-6930-59c7-f214-dfeb514084ff&l=82

These look to be the same build errors we're seeing on open Maui.Markup PRs: CommunityToolkit/Maui.Markup#336 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
blocked breaking change This label is used for PRs that include a breaking change
Projects
None yet
8 participants