From 725260b33a0aad60530567bdf396a2721a2b3403 Mon Sep 17 00:00:00 2001 From: Shaun Lawrence Date: Wed, 18 Dec 2024 01:14:32 +0000 Subject: [PATCH] Support .NET 9.0 (#2215) * Point to the .NET 9.0 release candidate * Tweak versions in the pipeline * allow prerelease builds * Find overlapping versions for AnxroidX libraries * Fix null reference type issue * Shift to TypedBindings * Keep disabling IL2092 for NET9_0 * Mark types as Dynamically accessed * Patch up Analyzer unit tests * Fix the AvatarView unit tests * Suppress warning disable IL2026 * Update comments in Camera project * Update src/CommunityToolkit.Maui.Analyzers.UnitTests/Verifiers/CSharpAnalyzerVerifier`1+Test.cs Co-authored-by: Brandon Minnick <13558917+brminnick@users.noreply.github.com> * Update src/CommunityToolkit.Maui.Analyzers.UnitTests/Verifiers/CSharpCodeFixVerifier`2+Test.cs Co-authored-by: Brandon Minnick <13558917+brminnick@users.noreply.github.com> * Include preview builds for benchmarks * Remove Obsolete code * Remove pragma now that unsafe code has been removed * Update ICommunityToolkitBehavior.shared.cs * Update Expander.shared.cs * `MainPage` -> `Windows[0].Page` * use `override CreateWindow(IActivationState)` to initialize AppShell * Increase to Xcode 16 * Make use of a TypedBinding instance to workaround current limitations * Remove ifdef * Enable `NuGetAudit` * Add WarningsAsErrors for `NuGetAudit` * Remove Obsolete PopupService method * Update for .NET 9 RC 2 * Update Android dependencies * Remove unrequired NuGet Packages * Fix Vulnerabilities * Resolve NuGet Dependency Conflicts * Remove reflection * Fix `Camera` Android Dependencies * Refactor return statement * Fix nullability error * Update AppShell.xaml * Increase to RC2 * Use `static` * Use `private protected` constructor * Stop automatically assigning Behavior BindingContext * Remove References to `TrySetBindingContextToAttachedViewBindingContext` * Update BaseBehaviorTest.cs * Refactor GravatarImageSource * Update CommunityToolkit.Maui.Sample.csproj * Update for CsWinRT1028, CsWinRT1030, XC0045, and XC0103 * Use `partial` for source generators * Use Syntax Highlighting for code blocks * Removed duplicate string * Remove References to Application.Current.MainPage * Fix typos * Update samples/CommunityToolkit.Maui.Sample/CommunityToolkit.Maui.Sample.csproj * Update samples/CommunityToolkit.Maui.Sample/Pages/Views/Expander/ExpanderPageCS.cs * Fix Find + Replace typo * Remove unused namespace * Remove `MainPage` * Add BindingContext to Behaviors in Sample App * Increase Android SupportedOSPlatformVersion to 26 * Fix XAML Warnings * Use `macos-15-arm64` * Update azure-pipelines.yml * Use Xcode version `16` * Revert back to macOS14 * Use BindingMode.OneWay * Fix PopupService Tests * Fix AvatarView Tests * Fix AvatarView Tests * Fix ParentWindowTests * Resolve AppTheme Tests * Add `[RequiresUnreferencedCode]` attribute to `ValidationBehavior` * Update BehaviorsGalleryPage.cs * `dotnet format` * Remove `Obsolete` attributes from `dotnet format` This reverts commit c762fb23b81bb16c4c21f16caeef100c8d32fd21. * Update `Microsoft.CodeAnalysis.CSharp.Workspaces` * Update Sample App NuGet Packages to .NET 9 * Remove Duplicate NuGet Packages * Fix https://github.com/CommunityToolkit/Maui/issues/2109 * Fix CameraView warnings * Refactor ShowKeyboardAsync * Refactor Code + Performance Improvements * `dotnet format` * Remove unused using directives * Add `[EditorBrowsable(EditorBrowsableState.Never)]` * Use `BindingBase.Create` * Update Options.cs * Renaming and changing ValidationFlags.ValidateOnFocus and ValidateOnUnfocus to ValidateOnUnfocusED as the naming makes more sense. This was from the MCT november standup... * Fix compiled bindings For MediaElement * Fix Windows crash on exiting Page or Application when using Media Element * Remove trace log added by accident * Fix `MultiValidationBehavior` compiled bindings * Fix `MultiConverterPage` Compiled Bindings * Remove `x:DataType` from several lines * Add using to enable support for logging * Fix `ColorsConverterPage` compiled bindings. This casts the `x:DataType` to `x:Reference` type. * Set `x:DataType` in `AppShell.xaml` to support compiled bindings * Update `LazyViewPage` to add support for compiled bindings We can set parent with `x:DataType` to cast on `Source` through inheritence. * Update `EmailValidationBehaviorPage` to support Compiled bindings * Update params collections * Update Xcode logic * Update azure-pipelines.yml * Update azure-pipelines.yml * Update azure-pipelines.yml * Increase to macOS-15 * Add SourceLink * Update CommunityToolkit.Maui.Sample.csproj * Update PopupServiceTests.cs * Resolve Failing DrawingView Unit Tests * Use Partial Properties * Support `CarouselViewHandler2` + `CollectionViewHandler2` for MediaElement * Update comment text * Update for .NET 9 GA * Update samples/CommunityToolkit.Maui.Sample/CommunityToolkit.Maui.Sample.csproj * Add `x:DataType` for Compiled Bindings * Update NuGet Packages * Remove reference * Update CommunityToolkit.Maui.Sample.csproj * Sort alphabetically * Set Behavior BindingContext * Enable IServiceProvider * Fix compareconverter demo * Fix Crash * Fix Behavior Binding * Add Behavior BindingContext * Add behavior BindingContext * Fix DrawingView sample * Use Enum.IsDefined * Fix Expander Binding * Update Maps for async/await + Trimming * Catch Element Not Found Exception * Modify CompareConverter signature to match IsInRangeConverter * Update Directory.Build.props * run `dotnet workload update` following `dotnet workload install maui` * Update azure-pipelines.yml * Revert "Update azure-pipelines.yml" This reverts commit c240aead2b018afc3d508017f2ebeb066185b235. * Use Primary Constructor, Update Formatting * Disable warnings on compiler-generated code * Prevent Usage with Microsoft.Maui.Controls v10.0.0+ * Organize Build props * Add `[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.All)]` * Update NuGet Packages * Add `//lang=csharp` to raw string literals * Implement `TheoryData` * Use `field` keyword * Add Xunit Usage Analyzers * Add Xunit Assertion Analyzers * Add Xunit Extensibility Analyzers * Resolve Trimming Errors * Bump Xcode to 16.1 * Update NuGet Packages * Add removed rules * Bump Windows-specific NuGet Packages * Add `FluentAssertions.Analyzers` * Bump TOOLKIT_NET_VERSION to `9.0.101` * Update NuGet Packages * Fix typo * Update Directory.Build.props * Opt-out of using managed-static for MacCatalyst * Update `xunit.runner.visualstudio` * Remove duplicate paranthesis * Remove AutoFixture * Update to `xunit.v3` * Increase minimum required .NET SDK Version * Fix Snackbar in Modal Page on Android * Fix Snackbar alignment on iOS * Fix bindings * Improve Android Build Times * Fix typo * Fix crash on iOS due to `null` * Use Partial Properties * Fix Android NavigationBar * `dotnet format` --------- Co-authored-by: Shaun Lawrence <17139988+bijington@users.noreply.github.com> Co-authored-by: Brandon Minnick <13558917+brminnick@users.noreply.github.com> Co-authored-by: Gerald Versluis Co-authored-by: CliffAgius Co-authored-by: James Crutchley --- .editorconfig | 11 +- Directory.Build.props | 194 ++++-- azure-pipelines.yml | 41 +- global.json | 2 +- .../CommunityToolkit.Maui.Sample/App.xaml.cs | 8 +- .../AppShell.xaml | 5 +- .../CommunityToolkit.Maui.Sample.csproj | 41 +- .../CompareDoubleToColorConverter.cs | 3 +- .../MauiProgram.cs | 15 +- .../Pages/Alerts/AlertsGalleryPage.cs | 2 +- .../Pages/Alerts/SnackbarPage.xaml | 2 +- .../Pages/Alerts/SnackbarPage.xaml.cs | 12 +- .../Pages/Alerts/ToastPage.xaml.cs | 12 +- .../Pages/Base/BaseGalleryPage.cs | 7 +- .../Behaviors/AnimationBehaviorPage.xaml | 14 +- .../Behaviors/AnimationBehaviorPage.xaml.cs | 4 +- .../Pages/Behaviors/BehaviorsGalleryPage.cs | 11 +- .../CharactersValidationBehaviorPage.xaml | 21 +- .../CharactersValidationBehaviorPage.xaml.cs | 3 +- .../EmailValidationBehaviorPage.xaml | 1 + .../Behaviors/EventToCommandBehaviorPage.xaml | 8 +- .../Behaviors/IconTintColorBehaviorPage.xaml | 14 +- .../MaxLengthReachedBehaviorPage.xaml | 25 +- .../MultiValidationBehaviorPage.xaml | 13 +- .../NumericValidationBehaviorPage.xaml | 2 +- .../ProgressBarAnimationBehaviorPage.xaml | 3 +- .../Behaviors/StatusBarBehaviorPage.xaml | 4 +- .../Behaviors/StatusBarBehaviorPage.xaml.cs | 2 +- ...viorCollectionViewMultipleSelectionPage.cs | 21 +- .../TouchBehavior/TouchBehaviorPage.xaml | 33 +- .../UserStoppedTypingBehaviorPage.xaml | 23 +- .../Converters/BoolToObjectConverterPage.xaml | 2 +- ...yteArrayToImageSourceConverterPage.xaml.cs | 1 - .../Pages/Converters/ColorsConverterPage.xaml | 4 +- .../Converters/CompareConverterPage.xaml | 4 +- .../Pages/Converters/ConvertersGalleryPage.cs | 2 +- .../IndexToArrayItemConverterPage.xaml | 10 +- .../Converters/IsInRangeConverterPage.cs | 4 +- .../ItemTappedEventArgsConverterPage.xaml | 2 + .../Pages/Converters/MultiConverterPage.xaml | 13 +- .../SelectedItemEventArgsConverterPage.xaml | 5 +- .../Pages/Essentials/EssentialsGalleryPage.cs | 2 +- .../Pages/Essentials/SpeechToTextPage.xaml.cs | 3 +- .../ColorAnimationExtensionsPage.xaml | 9 +- .../ColorAnimationExtensionsPage.xaml.cs | 2 +- .../Pages/Extensions/ExtensionsGalleryPage.cs | 2 +- .../ImageSources/ImageSourcesGalleryPage.cs | 2 +- .../Pages/Layouts/LayoutsGalleryPage.cs | 2 +- .../Pages/Layouts/UniformItemsLayoutPage.xaml | 4 +- .../Views/CameraView/CameraViewPage.xaml | 10 +- .../Views/CameraView/CameraViewPage.xaml.cs | 1 - .../Pages/Views/DrawingViewPage.xaml | 10 +- .../Pages/Views/Expander/ExpanderPage.xaml.cs | 5 +- .../Pages/Views/Expander/ExpanderPageCS.cs | 6 +- .../Pages/Views/LazyView/CustomLazyView.cs | 2 +- .../Pages/Views/LazyView/LazyViewPage.xaml | 17 +- .../Pages/Views/LazyView/LazyViewPage.xaml.cs | 2 +- .../Pages/Views/LazyView/MyViewLazyView.cs | 2 +- .../Pages/Views/Maps/BasicMapsPage.xaml | 8 +- .../MediaElementMultipleWindowsPage.cs | 2 +- .../Views/MediaElement/MediaElementPage.xaml | 17 +- .../Views/Popup/PopupSizingIssuesPage.xaml | 3 +- .../Pages/Views/ViewsGalleryPage.cs | 2 +- .../Pages/WelcomePage.cs | 2 +- .../Platforms/Android/MainActivity.cs | 1 - .../Platforms/MacCatalyst/AppDelegate.cs | 7 +- .../Platforms/iOS/AppDelegate.cs | 7 +- .../Alerts/AlertsGalleryViewModel.cs | 2 +- .../ViewModels/Alerts/SnackbarViewModel.cs | 2 +- .../ViewModels/Alerts/ToastViewModel.cs | 2 +- .../Behaviors/AnimationBehaviorViewModel.cs | 4 +- .../Behaviors/BehaviorsGalleryViewModel.cs | 2 +- .../CharactersValidationBehaviorViewModel.cs | 2 +- .../EmailValidationBehaviorViewModel.cs | 2 +- .../EventToCommandBehaviorViewModel.cs | 5 +- .../IconTintColorBehaviorViewModel.cs | 4 +- .../Behaviors/MaskedBehaviorViewModel.cs | 2 +- .../MaxLengthReachedBehaviorViewModel.cs | 5 +- .../MultiValidationBehaviorViewModel.cs | 2 +- .../NumericValidationBehaviorViewModel.cs | 2 +- .../ProgressBarAnimationBehaviorViewModel.cs | 2 +- ...quiredStringValidationBehaviorViewModel.cs | 2 +- .../SelectAllTextBehaviorViewModel.cs | 2 +- ...tFocusOnEntryCompletedBehaviorViewModel.cs | 2 +- .../Behaviors/StatusBarBehaviorViewModel.cs | 22 +- .../TextValidationBehaviorViewModel.cs | 2 +- .../TouchBehavior/TouchBehaviorViewModel.cs | 5 +- .../UriValidationBehaviorViewModel.cs | 2 +- .../UserStoppedTypingBehaviorViewModel.cs | 5 +- .../BoolToObjectConverterViewModel.cs | 2 +- ...yteArrayToImageSourceConverterViewModel.cs | 19 +- .../Converters/ColorsConverterViewModel.cs | 2 +- .../Converters/CompareConverterViewModel.cs | 2 +- .../Converters/ConvertersGalleryViewModel.cs | 52 +- .../DateTimeOffsetConverterViewModel.cs | 2 +- .../DoubleToIntConverterViewModel.cs | 2 +- .../EnumToBoolConverterViewModel.cs | 2 +- .../Converters/EnumToIntConverterViewModel.cs | 4 +- .../ImageResourceConverterViewModel.cs | 2 +- .../IndexToArrayItemConverterViewModel.cs | 2 +- .../Converters/IntToBoolConverterViewModel.cs | 2 +- .../InvertedBoolConverterViewModel.cs | 2 +- .../Converters/IsEqualConverterViewModel.cs | 2 +- .../Converters/IsInRangeConverterViewModel.cs | 2 +- .../IsListNotNullOrEmptyConverterViewModel.cs | 2 +- .../IsListNullOrEmptyConverterViewModel.cs | 6 +- .../IsNotEqualConverterViewModel.cs | 2 +- .../Converters/IsNotNullConverterViewModel.cs | 8 +- .../Converters/IsNullConverterViewModel.cs | 8 +- ...sStringNotNullOrEmptyConverterViewModel.cs | 2 +- ...ngNotNullOrWhiteSpaceConverterViewModel.cs | 2 +- .../IsStringNullOrEmptyConverterViewModel.cs | 2 +- ...tringNullOrWhiteSpaceConverterViewModel.cs | 2 +- .../ItemTappedEventArgsConverterViewModel.cs | 5 +- .../ListToStringConverterViewModel.cs | 2 +- .../MathExpressionConverterViewModel.cs | 2 +- .../Converters/MultiConverterViewModel.cs | 2 +- .../MultiMathExpressionConverterViewModel.cs | 6 +- ...SelectedItemEventArgsConverterViewModel.cs | 5 +- .../StateToBooleanConverterViewModel.cs | 5 +- .../StringToListConverterViewModel.cs | 2 +- .../Converters/TextCaseConverterViewModel.cs | 2 +- .../Essentials/AppThemeViewModel.cs | 2 +- .../Essentials/EssentialsGalleryViewModel.cs | 2 +- .../Essentials/FileSaverViewModel.cs | 4 +- .../Essentials/SpeechToTextViewModel.cs | 4 +- .../ColorAnimationExtensionsViewModel.cs | 2 +- .../Extensions/ExtensionsGalleryViewModel.cs | 2 +- .../Extensions/KeyboardExtensionsViewModel.cs | 2 +- .../GravatarImageSourceViewModel.cs | 8 +- .../ImageSourcesGalleryViewModel.cs | 2 +- .../ViewModels/Layouts/DockLayoutViewModel.cs | 2 +- .../Layouts/LayoutsGalleryViewModel.cs | 2 +- .../Layouts/StateContainerViewModel.cs | 2 +- .../Layouts/UniformItemsLayoutViewModel.cs | 1 - .../NavigationBarAndroidViewModel.cs | 19 +- .../PlatformSpecificGalleryViewModel.cs | 2 +- .../AvatarViewBindablePropertiesViewModel.cs | 2 +- .../AvatarView/AvatarViewBordersViewModel.cs | 2 +- .../AvatarView/AvatarViewColorsViewModel.cs | 2 +- .../AvatarViewDayOfWeekViewModel.cs | 2 +- .../AvatarView/AvatarViewGesturesPage.cs | 2 +- .../AvatarView/AvatarViewImagesViewModel.cs | 2 +- .../AvatarView/AvatarViewKeyboardViewModel.cs | 2 +- .../AvatarView/AvatarViewRatingViewModel.cs | 2 +- .../AvatarView/AvatarViewShadowsViewModel.cs | 2 +- .../AvatarView/AvatarViewShapesViewModel.cs | 2 +- .../AvatarView/AvatarViewSizesViewModel.cs | 2 +- .../Views/CameraView/CameraViewViewModel.cs | 8 +- .../ViewModels/Views/DrawingViewViewModel.cs | 2 +- .../Views/LazyView/LazyViewViewModel.cs | 2 +- .../Views/Maps/MapsPinsViewModel.cs | 2 +- .../ViewModels/Views/Maps/MapsViewModel.cs | 2 +- .../MediaElementMultipleWindowsViewModel.cs | 2 +- .../MediaElement/MediaElementViewModel.cs | 4 +- .../Popup/CsharpBindingPopupViewModel.cs | 4 +- .../CustomSizeAndPositionPopupViewModel.cs | 4 +- .../Views/Popup/PopupAnchorViewModel.cs | 4 +- .../Popup/PopupLayoutAlignmentViewModel.cs | 2 +- .../Views/Popup/PopupPositionViewModel.cs | 2 +- .../Views/Popup/PopupSizingIssuesViewModel.cs | 19 +- .../ShowPopupInOnAppearingPageViewModel.cs | 2 +- .../Views/Popup/UpdatingPopupViewModel.cs | 14 +- .../SemanticOrderViewPageViewModel.cs | 2 +- .../ViewModels/Views/ViewsGalleryViewModel.cs | 2 +- .../Views/NullableBoolComponentWithLabel.xaml | 4 +- .../Views/Popups/TransparentPopupCSharp.cs | 15 +- ...eMauiCommunityToolkitAnalyzerBenchmarks.cs | 4 +- ...ommunityToolkitCameraAnalyzerBenchmarks.cs | 4 +- ...ElementInitializationAnalyzerBenchmarks.cs | 4 +- ...ityToolkit.Maui.Analyzers.CodeFixes.csproj | 2 +- ...itInitializationAnalyzerCodeFixProvider.cs | 5 - ...ityToolkit.Maui.Analyzers.UnitTests.csproj | 13 +- ...oolkitCameraInitializationAnalyzerTests.cs | 156 ++--- ...unityToolkitInitializationAnalyzerTests.cs | 155 ++--- ...MediaElementInitializationAnalyzerTests.cs | 157 ++--- .../CSharpAnalyzerVerifier`1+Test.cs | 8 +- .../Verifiers/CSharpAnalyzerVerifier`1.cs | 2 +- .../Verifiers/CSharpCodeFixVerifier`2+Test.cs | 8 +- .../Verifiers/CSharpCodeFixVerifier`2.cs | 4 +- .../CommunityToolkit.Maui.Analyzers.csproj | 3 +- ...kit.Maui.Camera.Analyzers.CodeFixes.csproj | 2 +- ...munityToolkit.Maui.Camera.Analyzers.csproj | 3 +- .../CameraManager.android.cs | 25 +- .../CameraManager.macios.cs | 16 +- .../CameraManager.shared.cs | 12 +- .../CommunityToolkit.Maui.Camera.csproj | 30 +- .../CommunityToolkit.Maui.Camera.nuspec | 3 + .../Handlers/CameraViewHandler.shared.cs | 4 +- .../Interfaces/ICameraProvider.shared.cs | 4 +- .../MediaCaptureFailedEventArgs.shared.cs | 17 +- .../Providers/CameraProvider.android.cs | 4 +- .../Views/CameraView.shared.cs | 6 +- src/CommunityToolkit.Maui.Camera/linker.xml | 8 + .../CommunityToolkit.Maui.Core.csproj | 13 +- .../Badge/Android/BadgeFactory.android.cs | 7 +- .../FileSaver/FileSaveException.shared.cs | 14 +- .../FileSaverImplementation.android.cs | 1 - .../FileSaverImplementation.shared.cs | 2 +- .../FileSaver/FileSaverResult.shared.cs | 6 +- .../FolderPickerImplementation.android.cs | 6 +- .../SpeechToTextImplementation.android.cs | 11 +- .../Extensions/WindowExtensions.android.cs | 3 +- .../IPopupService.cs | 26 - .../Interfaces/IDockLayout.shared.cs | 10 +- .../Interfaces/IDrawingLine.shared.cs | 2 +- .../Interfaces/IDrawingView.shared.cs | 6 +- .../Interfaces/IExpander.shared.cs | 6 +- .../Interfaces/IPopup.shared.cs | 2 +- .../Interfaces/IUniformItemsLayout.shared.cs | 4 +- .../Layouts/DockLayoutManager.shared.cs | 16 +- .../UniformItemsLayoutManager.shared.cs | 22 +- .../KeyboardExtensions.shared.cs | 35 +- .../Platform/StatusBar/StatusBar.macos.cs | 3 +- .../DrawingLineCompletedEventArgs.shared.cs | 17 +- .../DrawingLineStartedEventArgs.shared.cs | 17 +- .../Primitives/ExpandDirection.shared.cs | 2 +- .../ExpandedChangedEventArgs.shared.cs | 15 +- .../Primitives/MathOperator.shared.cs | 40 +- ...auiDrawingLineCompletedEventArgs.shared.cs | 14 +- .../MauiDrawingStartedEventArgs.shared.cs | 14 +- .../MauiOnDrawingEventArgs.shared.cs | 14 +- .../Primitives/PointDrawnEventArgs.shared.cs | 17 +- .../PopupDismissedEventArgs.shared.cs | 35 +- .../Primitives/SnackbarOptions.shared.cs | 2 +- .../Views/Alert/AlertView.macios.cs | 2 +- .../Views/DrawingView/DrawingLine.shared.cs | 12 +- .../PlatformView/MauiDrawingLine.shared.cs | 8 +- .../PlatformView/MauiDrawingView.android.cs | 17 +- .../PlatformView/MauiDrawingView.net.cs | 3 +- .../PlatformView/MauiDrawingView.shared.cs | 16 +- .../Service/DrawingViewService.macios.cs | 21 +- .../Service/DrawingViewService.windows.cs | 5 + .../Views/PaddedButton.macios.cs | 16 +- .../Views/PaddedLabel.macios.cs | 28 +- .../Views/Popup/MauiPopup.android.cs | 46 +- .../Views/Popup/MauiPopup.macios.cs | 19 +- .../Views/Popup/PopupExtensions.android.cs | 18 +- .../Views/Popup/PopupExtensions.macios.cs | 7 +- .../Views/Popup/PopupExtensions.windows.cs | 6 +- .../Views/RoundedView.macios.cs | 37 +- .../MauiSemanticOrderView.android.cs | 33 +- .../MauiSemanticOrderView.macios.cs | 9 +- .../MauiSemanticOrderView.windows.cs | 7 +- .../Views/Snackbar/PlatformSnackbar.macios.cs | 4 +- .../Views/Toast/PlatformToast.macios.cs | 7 +- .../AppHostBuilderExtensions.shared.cs | 10 +- .../CommunityToolkit.Maui.Maps.csproj | 11 +- .../Handler/Map/MapHandler.Windows.cs | 83 +-- ...ui.MediaElement.Analyzers.CodeFixes.csproj | 2 +- ...Toolkit.Maui.MediaElement.Analyzers.csproj | 3 +- .../AppBuilderExtensions.shared.cs | 1 - .../CommunityToolkit.Maui.MediaElement.csproj | 9 +- .../Converters/MediaSourceConverter.cs | 7 +- .../Extensions/ElementExtensions.shared.cs | 1 - .../Extensions/PageExtensions.cs | 9 +- .../Handlers/MediaElementHandler.net.cs | 4 +- .../Interfaces/IMediaElement.cs | 2 +- .../MediaElement.shared.cs | 33 +- .../MediaSource/FileMediaSource.shared.cs | 2 +- .../MediaSource/MediaSource.shared.cs | 2 +- .../MediaSource/ResourceMediaSource.shared.cs | 2 +- .../MediaSource/UriMediaSource.shared.cs | 2 +- .../Primitives/MediaFailedEventArgs.cs | 17 +- .../MediaPositionChangedEventArgs.cs | 17 +- .../Primitives/MediaStateChangedEventArgs.cs | 22 +- .../Primitives/Metadata.macios.cs | 1 - .../Primitives/SeekRequestedEventArgs.cs | 17 +- .../Services/MediaControlsService.android.cs | 21 +- .../Views/MauiMediaElement.android.cs | 6 +- .../Views/MauiMediaElement.macios.cs | 21 +- .../Views/MauiMediaElement.windows.cs | 2 +- .../Views/MediaManager.android.cs | 53 +- .../Views/MediaManager.shared.cs | 1 + .../Views/MediaManager.windows.cs | 4 + ...indablePropertyAttributeSourceGenerator.cs | 113 ++-- ...lkit.Maui.SourceGenerators.Internal.csproj | 3 +- .../AnalyzerReleases.Shipped.md | 11 +- ...munityToolkit.Maui.SourceGenerators.csproj | 3 +- .../Extensions/NamespaceSymbolExtensions.cs | 4 +- .../Generators/TextColorToGenerator.cs | 186 +++--- .../Alerts/SnackbarTests.cs | 8 +- .../Alerts/ToastTests.cs | 2 +- .../BaseHandlerTest.cs | 35 +- .../Behaviors/BaseBehaviorTest.cs | 28 +- .../Behaviors/EmailValidationBehaviorTests.cs | 306 ++++++--- .../Behaviors/GestureManagerTests.cs | 2 +- .../Behaviors/ImageTouchBehaviorTests.cs | 1 - .../Behaviors/MaskedBehaviorTests.cs | 1 + .../MaxLengthReachedBehaviorTests.cs | 1 + .../ProgressBarAnimationBehaviorTests.cs | 16 +- .../SetFocusOnEntryCompletedTests.cs | 1 + .../UserStoppedTypingBehaviorTests.cs | 1 + .../Behaviors/ValidationBehaviorTests.cs | 4 +- .../CommunityToolkit.Maui.UnitTests.csproj | 11 +- .../Converters/BoolToObjectConverterTests.cs | 19 +- .../ByteArrayToImageSourceConverterTests.cs | 12 +- .../ColorToBlackOrWhiteConverterTests.cs | 66 +- .../ColorToByteAlphaConverterTests.cs | 47 +- .../ColorToByteBlueConverterTests.cs | 47 +- .../ColorToByteGreenConverterTests.cs | 49 +- .../ColorToByteRedConverterTests.cs | 47 +- .../ColorToCmykStringConverterTests.cs | 174 +++-- .../ColorToCmykaStringConverterTests.cs | 174 +++-- .../ColorToColorForTextConverterTests.cs | 66 +- .../ColorToDegreeHueConverterTests.cs | 134 ++-- .../ColorToGrayScaleColorConverterTests.cs | 66 +- .../ColorToHexArgbStringConverterTests.cs | 135 ++-- .../ColorToHexRgbStringConverterTests.cs | 174 +++-- .../ColorToHexRgbaStringConverterTests.cs | 174 +++-- .../ColorToHslStringConverterTests.cs | 171 +++-- .../ColorToHslaStringConverterTests.cs | 170 +++-- .../ColorToInverseColorConverterTests.cs | 46 +- .../ColorToPercentBlackKeyConverterTests.cs | 134 ++-- .../ColorToPercentCyanConverterTests.cs | 134 ++-- .../ColorToPercentMagentaConverterTests.cs | 134 ++-- .../ColorToPercentYellowConverterTests.cs | 142 +++-- .../ColorToRgbStringConverterTests.cs | 170 +++-- .../ColorToRgbaStringConverterTests.cs | 174 +++-- .../Converters/CompareConverterTests.cs | 159 +++-- .../DateTimeOffsetConverterTests.cs | 114 +++- .../Converters/EnumToIntConverterTests.cs | 2 +- .../Converters/ImageResourceConverterTests.cs | 8 +- .../Converters/IsInRangeConverterTests.cs | 546 ++++++++++++---- .../IsListNotNullOrEmptyConverterTests.cs | 26 +- .../IsListNullOrEmptyConverterTests.cs | 26 +- .../ItemTappedEventArgsConverterTests.cs | 24 +- .../Converters/ListToStringConverterTests.cs | 39 +- .../Converters/MultiConverterTests.cs | 26 +- .../SelectedItemEventArgsConverterTests.cs | 24 +- .../Converters/StringToListConverterTests.cs | 38 +- .../Converters/TextCaseConverterTests.cs | 73 ++- .../TimeSpanToSecondsConverterTests.cs | 22 +- .../Essentials/AppThemeTests.cs | 72 +-- .../Essentials/SpeechToTextTests.cs | 3 +- .../Extensions/BackgroundColorToTests.cs | 8 +- .../ColorConversionExtensionsTests.cs | 593 +++++++++--------- .../Extensions/TextColorToTests.cs | 30 +- .../GravatarImageSourceTests.cs | 2 +- .../Layouts/StateContainerTests.cs | 13 +- .../Mocks/FontElementHandlerStub.cs | 29 - .../Mocks/MockApplication.cs | 3 +- .../Mocks/MockShell.cs | 12 + .../Mocks/MockViewHandler.cs | 30 + .../Mocks/SpeechToTextImplementationMock.cs | 19 +- .../PopupServiceTests.cs | 290 +-------- .../Views/AvatarView/AvatarViewImageTests.cs | 2 +- .../AvatarView/AvatarViewInterfaceTests.cs | 18 +- .../Views/AvatarView/AvatarViewTests.cs | 33 +- .../Views/CameraView/CameraViewTests.cs | 2 +- .../DrawingView/DrawingLineAdapterTests.cs | 3 +- .../Views/DrawingView/DrawingLineTests.cs | 5 +- .../Views/DrawingView/DrawingViewTests.cs | 24 +- .../Expander/ExpandedChangedEventArgsTests.cs | 4 +- .../Views/LazyView/LazyViewTests.cs | 4 +- .../Views/MediaElement/MediaElementTests.cs | 6 +- .../Views/MediaElement/ParentWindowTests.cs | 39 +- .../Views/Popup/PopupTests.cs | 23 +- .../SemanticOrderViewTests.cs | 2 +- .../Alerts/Snackbar/Snackbar.android.cs | 108 ++-- .../Alerts/Snackbar/Snackbar.macios.cs | 6 +- .../Alerts/Snackbar/Snackbar.shared.cs | 14 +- .../Alerts/Toast/Toast.android.cs | 9 +- .../Alerts/Toast/Toast.macios.cs | 13 +- .../Alerts/Toast/Toast.shared.cs | 24 +- .../Animations/BaseAnimation.shared.cs | 28 +- .../Animations/FadeAnimation.shared.cs | 12 +- .../AppBuilderExtensions.shared.cs | 4 +- .../Behaviors/AnimationBehavior.shared.cs | 58 +- ...SetFocusOnEntryCompletedBehavior.shared.cs | 2 +- .../Behaviors/BaseBehavior.shared.cs | 26 +- .../EventToCommandBehavior.shared.cs | 2 +- .../EventToCommandBehaviorGeneric.shared.cs | 2 +- .../ICommunityToolkitBehavior.shared.cs | 47 +- .../ImpliedOrderGridBehavior.shared.cs | 2 +- .../Behaviors/MaskedBehavior.shared.cs | 3 +- .../MaxLengthReachedBehavior.shared.cs | 2 +- .../MaxLengthReachedEventArgs.shared.cs | 15 +- .../BasePlatformBehavior.shared.cs | 4 +- .../IconTintColorBehavior.android.cs | 7 +- .../IconTintColorBehavior.macios.cs | 2 +- .../SelectAllTextBehavior.windows.cs | 9 +- .../StatusBar/StatusBarBehavior.shared.cs | 8 +- .../Touch/GestureManager.shared.cs | 4 +- .../Touch/TouchBehavior.android.cs | 9 - .../Touch/TouchBehavior.macios.cs | 25 +- .../Touch/TouchBehavior.methods.shared.cs | 2 +- .../ProgressBarAnimationBehavior.shared.cs | 2 +- .../UserStoppedTypingBehavior.shared.cs | 2 +- .../CharactersValidationBehavior.shared.cs | 10 +- .../EmailValidationBehavior.shared.cs | 5 +- .../MultiValidationBehavior.shared.cs | 43 +- .../NumericValidationBehavior.shared.cs | 16 +- ...RequiredStringValidationBehavior.shared.cs | 7 +- .../TextValidationBehavior.shared.cs | 7 +- .../UriValidationBehavior.shared.cs | 7 +- .../Validators/ValidationBehavior.shared.cs | 32 +- .../CommunityToolkit.Maui.csproj | 9 +- .../Converters/BaseConverter.shared.cs | 14 +- .../Converters/BaseConverterOneWay.shared.cs | 6 +- .../BoolToObjectConverter.shared.cs | 8 +- .../ByteArrayToImageSourceConverter.shared.cs | 10 +- .../ColorToColorConverters.shared.cs | 12 +- .../ColorToComponentConverter.shared.cs | 27 +- .../ColorToStringConverter.shared.cs | 34 +- .../Converters/CompareConverter.shared.cs | 8 +- .../DateTimeOffsetConverter.shared.cs | 6 +- .../Converters/DoubleToIntConverter.shared.cs | 4 +- .../Converters/EnumToBoolConverter.shared.cs | 5 +- .../Converters/EnumToIntConverter.shared.cs | 4 +- .../ICommunityToolkitValueConverter.shared.cs | 4 - .../ImageResourceConverter.shared.cs | 3 +- .../IndexToArrayItemConverter.shared.cs | 12 +- .../Converters/IntToBoolConverter.shared.cs | 7 +- .../InvertedBoolConverter.shared.cs | 5 +- .../Converters/IsEqualConverter.shared.cs | 3 +- .../Converters/IsInRangeConverter.shared.cs | 7 +- .../IsListNotNullOrEmptyConverter.shared.cs | 9 +- .../IsListNullOrEmptyConverter.shared.cs | 23 +- .../Converters/IsNotEqualConverter.shared.cs | 3 +- .../Converters/IsNotNullConverter.shared.cs | 7 +- .../Converters/IsNullConverter.shared.cs | 7 +- .../IsStringNotNullOrEmptyConverter.shared.cs | 9 +- .../IsStringNotNullOrWhiteSpaceConverter.cs | 9 +- .../IsStringNullOrEmptyConverter.shared.cs | 7 +- ...sStringNullOrWhiteSpaceConverter.shared.cs | 7 +- .../ItemTappedEventArgsConverter.shared.cs | 3 +- .../ListToStringConverter.shared.cs | 11 +- .../MathExpression.shared.cs | 22 +- .../MathExpressionConverter.shared.cs | 3 +- .../MultiMathExpressionConverter.shared.cs | 1 + .../Converters/MultiConverter.shared.cs | 12 +- .../MultiConverterParameter.shared.cs | 5 +- .../SelectedItemEventArgsConverter.cs | 3 +- .../StateToBooleanConverter.shared.cs | 15 +- .../StringToListConverter.shared.cs | 20 +- .../Converters/TextCaseConverter.shared.cs | 18 +- .../TimeSpanToSecondsConverter.shared.cs | 5 +- .../VariableMultiValueConverter.shared.cs | 5 +- .../AppThemeResourceExtension.shared.cs | 4 +- .../ColorAnimationExtensions.shared.cs | 4 +- .../CryptographyExtensions.shared.cs | 2 +- ...opertyChangedEventArgsExtensions.shared.cs | 28 +- .../ServiceCollectionExtensions.shared.cs | 2 +- .../Extensions/VisualElementExtensions.cs | 3 +- .../Popup/Popup.macios.cs | 43 +- .../GravatarImageSource.shared.cs | 30 +- .../Layouts/DockLayout.shared.cs | 2 +- .../StateContainerController.shared.cs | 2 +- .../Layouts/UniformItemsLayout.shared.cs | 2 +- src/CommunityToolkit.Maui/Options.cs | 23 +- ...pl.android.cs => NavigationBar.android.cs} | 13 +- ...tionBar.Properties.cs => NavigationBar.cs} | 4 +- .../Popup/PopupLifecycleController.cs | 4 +- src/CommunityToolkit.Maui/PopupService.cs | 136 ++-- .../Views/AvatarView.shared.cs | 6 +- .../Views/DrawingView/DrawingView.shared.cs | 13 +- .../Views/Expander/Expander.macios.cs | 1 - .../Views/Expander/Expander.shared.cs | 11 +- .../Views/LazyView/LazyView.shared.cs | 4 +- .../Views/Popup/Popup.shared.cs | 24 +- .../Views/Popup/PopupExtensions.windows.cs | 9 +- .../SemanticOrderView.shared.cs | 2 +- 463 files changed, 5889 insertions(+), 4124 deletions(-) create mode 100644 src/CommunityToolkit.Maui.Camera/CommunityToolkit.Maui.Camera.nuspec create mode 100644 src/CommunityToolkit.Maui.Camera/linker.xml delete mode 100644 src/CommunityToolkit.Maui.UnitTests/Mocks/FontElementHandlerStub.cs create mode 100644 src/CommunityToolkit.Maui.UnitTests/Mocks/MockShell.cs create mode 100644 src/CommunityToolkit.Maui.UnitTests/Mocks/MockViewHandler.cs rename src/CommunityToolkit.Maui/PlatformConfiguration/AndroidSpecific/{NavigationBar.Impl.android.cs => NavigationBar.android.cs} (88%) rename src/CommunityToolkit.Maui/PlatformConfiguration/AndroidSpecific/{NavigationBar.Properties.cs => NavigationBar.cs} (97%) diff --git a/.editorconfig b/.editorconfig index 467b91c05c..bce167771a 100644 --- a/.editorconfig +++ b/.editorconfig @@ -142,4 +142,13 @@ dotnet_diagnostic.CA2208.severity = error dotnet_diagnostic.CA1834.severity = error # IDE0220: Add explicit cast -dotnet_diagnostic.IDE0220.severity = error \ No newline at end of file +dotnet_diagnostic.IDE0220.severity = error + +# Warning CA2264 : Calling 'ArgumentNullException.ThrowIfNull' and passing a non-nullable value is a no-op +dotnet_diagnostic.CA2264.severity = error + +# MVMTK0042: The field [ObservableProperty] can be converted to a partial property +dotnet_diagnostic.MVMTK0042.severity = error + +# XC0045: Binding Property not found +dotnet_diagnostic.XC0045.severity = error \ No newline at end of file diff --git a/Directory.Build.props b/Directory.Build.props index b7803c1c6f..0c943b5fb4 100644 --- a/Directory.Build.props +++ b/Directory.Build.props @@ -1,17 +1,26 @@ - net8.0 - 8.0.71 - latest enable - enable NETSDK1023 - true - true - false + net9.0 + preview + enable true + true true + false + + + enable + all + + + 9.0.21 + 10.0.0 + true + true + true false @@ -39,40 +48,153 @@ CS1712: Type parameter has no matching typeparam tag in the XML comment CS1723: XML comment has cref attribute that refers to a type parameter CS1734: XML comment has a paramref tag, but there is no parameter by that name - - xUnit1012: Null should not be used for type parameter - xUnit2021: Assert.ThrowsAsync is async. The resulting task should be awaited - - IL2***: Trim Warnings - - IL3***: AOT Warnings - + MVMTK0042: The field [ObservableProperty] can be converted to a partial property + CsWinRT1028: Class implements WinRT interfaces but isn't marked partial + CsWinRT1030: Class implements WinRT interfaces that require unsafe code + NU1900 Error communicating with package source, while getting vulnerability information. + NU1901 Package with low severity detected + NU1902 Package with moderate severity detected + NU1903 Package with high severity detected + NU1904 Package with critical severity detected + NU1905 An audit source does not provide a vulnerability database + xUnit1000: Test classes must be public + xUnit1001: Fact methods cannot have parameters + xUnit1002: Test methods cannot have multiple Fact or Theory attributes + xUnit1003: Theory methods must have test data + xUnit1004: Test methods should not be skipped + xUnit1005: Fact methods should not have test data + xUnit1006: Theory methods should have parameters + xUnit1007: ClassData must point at a valid class + xUnit1008: Test data attribute should only be used on a Theory + xUnit1009: InlineData values must match the number of method parameters + xUnit1010: The value is not convertible to the method parameter type + xUnit1011: There is no matching method parameter + xUnit1012: Null should not be used for value type parameters + xUnit1013: Public method should be marked as test + xUnit1014: MemberData should use nameof operator for member name + xUnit1015: MemberData must reference an existing member + xUnit1016: MemberData must reference a public member + xUnit1017: MemberData must reference a static member + xUnit1018: MemberData must reference a valid member kind + xUnit1019: MemberData must reference a member providing a valid data type + xUnit1020: MemberData must reference a property with a getter + xUnit1021: MemberData should not have parameters if the referenced member is not a method + xUnit1022: Theory methods cannot have a parameter array + xUnit1023: Theory methods cannot have default parameter values + xUnit1024: Test methods cannot have overloads + xUnit1025: InlineData should be unique within the Theory it belongs to + xUnit1026: Theory methods should use all of their parameters + xUnit1027: Collection definition classes must be public + xUnit1028: Test method must have valid return type + xUnit1029: Local functions cannot be test functions + xUnit1030: Do not call ConfigureAwait in test method + xUnit1031: Do not use blocking task operations in test method + xUnit1032: Test classes cannot be nested within a generic class + xUnit1033: Test classes decorated with 'Xunit.IClassFixture' or 'Xunit.ICollectionFixture' should add a constructor argument of type TFixture + xUnit1034: Null should only be used for nullable parameters + xUnit1035: The value is not convertible to the method parameter type + xUnit1036: There is no matching method parameter + xUnit1037: There are fewer theory data type arguments than required by the parameters of the test method + xUnit1038: There are more theory data type arguments than allowed by the parameters of the test method + xUnit1039: The type argument to theory data is not compatible with the type of the corresponding test method parameter + xUnit1040: The type argument to theory data is nullable, while the type of the corresponding test method parameter is not + xUnit1041: Fixture arguments to test classes must have fixture sources + xUnit1042: The member referenced by the MemberData attribute returns untyped data rows + xUnit1043: Constructors on classes derived from FactAttribute must be public when used on test methods + xUnit1048: Avoid using 'async void' for test methods as it is deprecated in xUnit.net v3 + xUnit1049: Do not use 'async void' for test methods as it is no longer supported + xUnit1050: The class referenced by the ClassData attribute returns untyped data rows + xUnit1051: Calls to methods which accept CancellationToken should use TestContext.Current.CancellationToken + xUnit2000: Constants and literals should be the expected argument + xUnit2001: Do not use invalid equality check + xUnit2002: Do not use null check on value type + xUnit2003: Do not use equality check to test for null value + xUnit2004: Do not use equality check to test for boolean conditions + xUnit2005: Do not use identity check on value type + xUnit2006: Do not use invalid string equality check + xUnit2007: Do not use typeof expression to check the type + xUnit2008: Do not use boolean check to match on regular expressions + xUnit2009: Do not use boolean check to check for substrings + xUnit2010: Do not use boolean check to check for string equality + xUnit2011: Do not use empty collection check + xUnit2012: Do not use Enumerable.Any() to check if a value exists in a collection + xUnit2013: Do not use equality check to check for collection size. + xUnit2014: Do not use throws check to check for asynchronously thrown exception + xUnit2015: Do not use typeof expression to check the exception type + xUnit2016: Keep precision in the allowed range when asserting equality of doubles or decimals. + xUnit2017: Do not use Contains() to check if a value exists in a collection + xUnit2018: Do not compare an object's exact type to an abstract class or interface + xUnit2019: Do not use obsolete throws check to check for asynchronously thrown exception + xUnit2020: Do not use always-failing boolean assertion to fail a test + xUnit2021: Async assertions should be awaited + xUnit2022: Boolean assertions should not be negated + xUnit2023: Do not use collection methods for single-item collections + xUnit2024: Do not use boolean asserts for simple equality tests + xUnit2025: The boolean assertion statement can be simplified + xUnit2026: Comparison of sets must be done with IEqualityComparer + xUnit2027: Comparison of sets to linear containers have undefined results + xUnit2028: Do not use Assert.Empty or Assert.NotEmpty with problematic types + xUnit2029: Do not use Assert.Empty to check if a value does not exist in a collection + xUnit2030: Do not use Assert.NotEmpty to check if a value exists in a collection + xUnit2031: Do not use Where clause with Assert.Single + xUnit2032: Type assertions based on 'assignable from' are confusingly named + xUnit3000: Classes which cross AppDomain boundaries must derive directly or indirectly from LongLivedMarshalByRefObject + xUnit3001: Classes that are marked as serializable (or created by the test framework at runtime) must have a public parameterless constructor + xUnit3002: Classes which are JSON serializable should not be tested for their concrete type + XC0045: Binding: Property not found + XC0103: Consider attributing the markup extension with [RequireService] or [AcceptEmptyServiceProvider] if it doesn't require any + IL2***: Trim Warnings + IL3***: AOT Warnings RS2007: Analyzer release file 'AnalyzerReleases.Shipped.md' has a missing or invalid release header--> - nullable, - CS0419,CS1570,CS1571,CS1572,CS1573,CS1574,CS1580,CS1581,CS1584,CS1587,CS1589,CS1590,CS1591,CS1592,CS1598,CS1658,CS1710,CS1711,CS1712,CS1723,CS1734, - xUnit1012,xUnit2021, - IL2001,IL2002,IL2003,IL2004,IL2005,IL2006,IL2007,IL2008,IL2009, - IL2010,IL2011,IL2012,IL2013,IL2014,IL2015,IL2016,IL2017,IL2018,IL2019, - IL2020,IL2021,IL2022,IL2023,IL2024,IL2025,IL2026,IL2027,IL2028,IL2029, - IL2030,IL2031,IL2032,IL2033,IL2034,IL2035,IL2036,IL2037,IL2038,IL2039, - IL2040,IL2041,IL2042,IL2043,IL2044,IL2045,IL2046,IL2047,IL2048,IL2049, - IL2050,IL2051,IL2052,IL2053,IL2054,IL2055,IL2056,IL2057,IL2058,IL2059, - IL2060,IL2061,IL2062,IL2063,IL2064,IL2065,IL2066,IL2067,IL2068,IL2069, - IL2070,IL2071,IL2072,IL2073,IL2074,IL2075,IL2076,IL2077,IL2078,IL2079, - IL2080,IL2081,IL2082,IL2083,IL2084,IL2085,IL2086,IL2087,IL2088,IL2089, - IL2090,IL2091,IL2092,IL2093,IL2094,IL2095,IL2096,IL2097,IL2098,IL2099, - IL2100,IL2101,IL2102,IL2103,IL2104,IL2105,IL2106,IL2107,IL2108,IL2109, - IL2110,IL2111,IL2112,IL2113,IL2114,IL2115,IL2116,IL2117,IL2118,IL2119, - IL2120,IL2121,IL2122, - IL3050,IL3051,IL3052,IL3053,IL3054,IL3055,IL3056, - RS2007 - + + nullable, + CS0419,CS1570,CS1571,CS1572,CS1573,CS1574,CS1580,CS1581,CS1584,CS1587,CS1589,CS1590,CS1591,CS1592,CS1598,CS1658,CS1710,CS1711,CS1712,CS1723,CS1734, + CsWinRT1028,CsWinRT1030, + MVMTK0042, + NU1900,NU1901,NU1902,NU1903,NU1904,NU1905, + xUnit1000,xUnit1001,xUnit1002,xUnit1003,xUnit1004,xUnit1005,xUnit1006,xUnit1007,xUnit1008,xUnit1009,xUnit1010,xUnit1011,xUnit1012,xUnit1013,xUnit1014,xUnit1015,xUnit1016,xUnit1017,xUnit1018,xUnit1019,xUnit1020,xUnit1021,xUnit1022,xUnit1023,xUnit1024,xUnit1025,xUnit1026,xUnit1027,xUnit1028,xUnit1029,xUnit1030,xUnit1031,xUnit1032,xUnit1033,xUnit1034,xUnit1035,xUnit1036,xUnit1037,xUnit1038,xUnit1039,xUnit1040,xUnit1041,xUnit1042,xUnit1043,xUnit1048,xUnit1049,xUnit1050,xUnit1051, + xUnit2000,xUnit2001,xUnit2002,xUnit2003,xUnit2004,xUnit2005,xUnit2006,xUnit2007,xUnit2008,xUnit2009,xUnit2010,xUnit2011,xUnit2012,xUnit2013,xUnit2014,xUnit2015,xUnit2016,xUnit2017,xUnit2018,xUnit2019,xUnit2020,xUnit2021,xUnit2022,xUnit2023,xUnit2024,xUnit2025,xUnit2026,xUnit2027,xUnit2028,xUnit2029,xUnit2030,xUnit2031,xUnit2032, + xUnit3000,xUnit3001,xUnit3002, + XC0045,XC0103, + IL2001,IL2002,IL2003,IL2004,IL2005,IL2006,IL2007,IL2008,IL2009, + IL2010,IL2011,IL2012,IL2013,IL2014,IL2015,IL2016,IL2017,IL2018,IL2019, + IL2020,IL2021,IL2022,IL2023,IL2024,IL2025,IL2026,IL2027,IL2028,IL2029, + IL2030,IL2031,IL2032,IL2033,IL2034,IL2035,IL2036,IL2037,IL2038,IL2039, + IL2040,IL2041,IL2042,IL2043,IL2044,IL2045,IL2046,IL2047,IL2048,IL2049, + IL2050,IL2051,IL2052,IL2053,IL2054,IL2055,IL2056,IL2057,IL2058,IL2059, + IL2060,IL2061,IL2062,IL2063,IL2064,IL2065,IL2066,IL2067,IL2068,IL2069, + IL2070,IL2071,IL2072,IL2073,IL2074,IL2075,IL2076,IL2077,IL2078,IL2079, + IL2080,IL2081,IL2082,IL2083,IL2084,IL2085,IL2086,IL2087,IL2088,IL2089, + IL2090,IL2091,IL2092,IL2093,IL2094,IL2095,IL2096,IL2097,IL2098,IL2099, + IL2100,IL2101,IL2102,IL2103,IL2104,IL2105,IL2106,IL2107,IL2108,IL2109, + IL2110,IL2111,IL2112,IL2113,IL2114,IL2115,IL2116,IL2117,IL2118,IL2119, + IL2120,IL2121,IL2122, + IL3050,IL3051,IL3052,IL3053,IL3054,IL3055,IL3056, + RS2007 + + + + + + + true + + + true + + + true + + + embedded - + + - + + true diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 469a819ccc..7e30ed19e3 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -6,8 +6,8 @@ variables: NugetPackageVersionCamera: '$(CurrentSemanticVersion)' NugetPackageVersionMediaElement: '$(CurrentSemanticVersion)' NugetPackageVersionMaps: '$(CurrentSemanticVersion)' - TOOLKIT_NET_VERSION: '8.0.303' - LATEST_NET_VERSION: '8.0.x' + TOOLKIT_NET_VERSION: '9.0.101' + LATEST_NET_VERSION: '9.0.x' PathToLibrarySolution: 'src/CommunityToolkit.Maui.sln' PathToSamplesSolution: 'samples/CommunityToolkit.Maui.Sample.sln' PathToCommunityToolkitCsproj: 'src/CommunityToolkit.Maui/CommunityToolkit.Maui.csproj' @@ -28,8 +28,8 @@ variables: PathToCommunityToolkitAnalyzersUnitTestCsproj: 'src/CommunityToolkit.Maui.Analyzers.UnitTests/CommunityToolkit.Maui.Analyzers.UnitTests.csproj' PathToCommunityToolkitAnalyzersBenchmarkCsproj: 'src/CommunityToolkit.Maui.Analyzers.Benchmarks/CommunityToolkit.Maui.Analyzers.Benchmarks.csproj' DotNetMauiRollbackFile: 'https://maui.blob.core.windows.net/metadata/rollbacks/8.0.6.json' - CommunityToolkitSampleApp_Xcode_Version: '16' - CommunityToolkitLibrary_Xcode_Version: '15.4' + CommunityToolkitSampleApp_Xcode_Version: '16.1' + CommunityToolkitLibrary_Xcode_Version: '16.1' trigger: branches: @@ -61,7 +61,7 @@ jobs: 'Windows': image: 'windows-latest' 'macOS': - image: 'macos-14' + image: 'macos-15' pool: vmImage: $(image) steps: @@ -69,7 +69,10 @@ jobs: displayName: 'Set Xcode v$(CommunityToolkitSampleApp_Xcode_Version)' condition: eq(variables['Agent.OS'], 'Darwin') # Only run this step on macOS inputs: - script: echo '##vso[task.setvariable variable=MD_APPLE_SDK_ROOT;]'/Applications/Xcode_$(CommunityToolkitSampleApp_Xcode_Version).app;sudo xcode-select --switch /Applications/Xcode_$(CommunityToolkitSampleApp_Xcode_Version).app/Contents/Developer + script: | + echo Installed Xcode Versions: + ls -al /Applications | grep Xcode + echo '##vso[task.setvariable variable=MD_APPLE_SDK_ROOT;]'/Applications/Xcode_$(CommunityToolkitSampleApp_Xcode_Version).app;sudo xcode-select --switch /Applications/Xcode_$(CommunityToolkitSampleApp_Xcode_Version).app/Contents/Developer - task: UseDotNet@2 displayName: 'Install Latest .NET SDK, v$(LATEST_NET_VERSION)' @@ -81,7 +84,9 @@ jobs: - task: CmdLine@2 displayName: 'Install Latest .NET MAUI Workload' inputs: - script: 'dotnet workload install maui' + script: | + dotnet workload install maui + dotnet workload update - powershell: | Invoke-WebRequest 'https://raw.githubusercontent.com/Samsung/Tizen.NET/main/workload/scripts/workload-install.ps1' -OutFile 'workload-install.ps1' @@ -139,7 +144,7 @@ jobs: 'Windows': image: 'windows-latest' 'macOS': - image: 'macos-14' + image: 'macos-15' pool: vmImage: $(image) steps: @@ -199,7 +204,10 @@ jobs: displayName: 'Set Xcode v$(CommunityToolkitLibrary_Xcode_Version)' condition: eq(variables['Agent.OS'], 'Darwin') # Only run this step on macOS inputs: - script: echo '##vso[task.setvariable variable=MD_APPLE_SDK_ROOT;]'/Applications/Xcode_$(CommunityToolkitLibrary_Xcode_Version).app;sudo xcode-select --switch /Applications/Xcode_$(CommunityToolkitLibrary_Xcode_Version).app/Contents/Developer + script: | + echo Installed Xcode Versions: + ls -al /Applications | grep Xcode + echo '##vso[task.setvariable variable=MD_APPLE_SDK_ROOT;]'/Applications/Xcode_$(CommunityToolkitLibrary_Xcode_Version).app;sudo xcode-select --switch /Applications/Xcode_$(CommunityToolkitLibrary_Xcode_Version).app/Contents/Developer - task: UseDotNet@2 displayName: Install .NET v$(TOOLKIT_NET_VERSION) @@ -211,7 +219,9 @@ jobs: - task: CmdLine@2 displayName: 'Install .NET MAUI Workload $(TOOLKIT_NET_VERSION)' inputs: - script: dotnet workload install maui --skip-sign-check --source https://api.nuget.org/v3/index.json + script: | + dotnet workload install maui + dotnet workload update - powershell: | Invoke-WebRequest 'https://raw.githubusercontent.com/Samsung/Tizen.NET/main/workload/scripts/workload-install.ps1' -OutFile 'workload-install.ps1' @@ -451,13 +461,14 @@ jobs: 'Windows': image: 'windows-latest' 'macOS': - image: 'macos-14' + image: 'macos-15' pool: vmImage: $(image) steps: - script: | - sudo xcode-select -s /Applications/Xcode_$(CommunityToolkitLibrary_Xcode_Version).app - sudo xcode-select -p + echo Installed Xcode Versions: + ls -al /Applications | grep Xcode + echo '##vso[task.setvariable variable=MD_APPLE_SDK_ROOT;]'/Applications/Xcode_$(CommunityToolkitLibrary_Xcode_Version).app;sudo xcode-select --switch /Applications/Xcode_$(CommunityToolkitLibrary_Xcode_Version).app/Contents/Developer displayName: 'Set Xcode v$(CommunityToolkitLibrary_Xcode_Version)' condition: eq(variables['Agent.OS'], 'Darwin') # Only run this step on macOS @@ -471,7 +482,9 @@ jobs: - task: CmdLine@2 displayName: 'Install .NET MAUI Workload' inputs: - script : 'dotnet workload install maui' + script : | + dotnet workload install maui + dotnet workload update - pwsh: | Invoke-WebRequest 'https://raw.githubusercontent.com/Samsung/Tizen.NET/main/workload/scripts/workload-install.ps1' -OutFile 'workload-install.ps1' diff --git a/global.json b/global.json index ce2e41208c..9455c4195b 100644 --- a/global.json +++ b/global.json @@ -1,6 +1,6 @@ { "sdk": { - "version": "8.0.303", + "version": "9.0.101", "rollForward": "latestFeature", "allowPrerelease": false } diff --git a/samples/CommunityToolkit.Maui.Sample/App.xaml.cs b/samples/CommunityToolkit.Maui.Sample/App.xaml.cs index 9b356596ed..64634e88c9 100644 --- a/samples/CommunityToolkit.Maui.Sample/App.xaml.cs +++ b/samples/CommunityToolkit.Maui.Sample/App.xaml.cs @@ -4,10 +4,14 @@ namespace CommunityToolkit.Maui.Sample; public partial class App : Application { - public App() + readonly AppShell appShell; + + public App(AppShell appShell) { InitializeComponent(); - MainPage = new AppShell(); + this.appShell = appShell; } + + protected override Window CreateWindow(IActivationState? activationState) => new(appShell); } \ No newline at end of file diff --git a/samples/CommunityToolkit.Maui.Sample/AppShell.xaml b/samples/CommunityToolkit.Maui.Sample/AppShell.xaml index 1ee3e5751a..5cd35824d3 100644 --- a/samples/CommunityToolkit.Maui.Sample/AppShell.xaml +++ b/samples/CommunityToolkit.Maui.Sample/AppShell.xaml @@ -17,8 +17,8 @@ x:Name="flyout" Title="{OnPlatform WinUI='Toolkit Features', Default={x:Null}}" FlyoutBackgroundColor="{OnPlatform WinUI=Transparent, - Default={AppThemeBinding Light={StaticResource White}, - Dark={StaticResource Black}}}" + Default={AppThemeBinding Light= White, + Dark= Black}}" FlyoutBehavior="{OnPlatform WinUI=Locked, Default=Flyout}"> @@ -100,6 +100,7 @@ diff --git a/samples/CommunityToolkit.Maui.Sample/CommunityToolkit.Maui.Sample.csproj b/samples/CommunityToolkit.Maui.Sample/CommunityToolkit.Maui.Sample.csproj index b07f22205f..02e75fa0bc 100644 --- a/samples/CommunityToolkit.Maui.Sample/CommunityToolkit.Maui.Sample.csproj +++ b/samples/CommunityToolkit.Maui.Sample/CommunityToolkit.Maui.Sample.csproj @@ -29,11 +29,11 @@ - - - 10.0.19041.53 true + + + CsWinRT1028 - + true - + @@ -65,19 +65,20 @@ - - - - + + + + + - 14.2 - 14.0 - 21.0 - 10.0.17763.0 + 15.0 + 15.0 + 26.0 + 10.0.19041.0 6.5 - 10.0.17763.0 + 10.0.19041.0 @@ -94,12 +95,14 @@ win-x64 - - true - android-arm;android-arm64;android-x86;android-x64 - - maccatalyst-arm64;maccatalyst-x64 + + + + + static + + \ No newline at end of file diff --git a/samples/CommunityToolkit.Maui.Sample/Converters/CompareDoubleToColorConverter.cs b/samples/CommunityToolkit.Maui.Sample/Converters/CompareDoubleToColorConverter.cs index fedcc50530..565e3d97ed 100644 --- a/samples/CommunityToolkit.Maui.Sample/Converters/CompareDoubleToColorConverter.cs +++ b/samples/CommunityToolkit.Maui.Sample/Converters/CompareDoubleToColorConverter.cs @@ -6,6 +6,7 @@ namespace CommunityToolkit.Maui.Sample.Converters; /// Compares a double value against the ComparingValue property /// and returns a based on the comparison. /// -public sealed class CompareDoubleToColorConverter : CompareConverter +[AcceptEmptyServiceProvider] +public sealed partial class CompareDoubleToColorConverter : CompareConverter { } \ No newline at end of file diff --git a/samples/CommunityToolkit.Maui.Sample/MauiProgram.cs b/samples/CommunityToolkit.Maui.Sample/MauiProgram.cs index 4e9f913559..3fbe220fba 100644 --- a/samples/CommunityToolkit.Maui.Sample/MauiProgram.cs +++ b/samples/CommunityToolkit.Maui.Sample/MauiProgram.cs @@ -1,6 +1,5 @@ using System.Diagnostics.CodeAnalysis; using CommunityToolkit.Maui.ApplicationModel; -using CommunityToolkit.Maui.Maps; using CommunityToolkit.Maui.Markup; using CommunityToolkit.Maui.Media; using CommunityToolkit.Maui.Sample.Models; @@ -34,6 +33,7 @@ using Polly; #if WINDOWS10_0_17763_0_OR_GREATER +using CommunityToolkit.Maui.Maps; using Microsoft.UI; using Microsoft.UI.Composition.SystemBackdrops; using Microsoft.UI.Windowing; @@ -47,6 +47,7 @@ namespace CommunityToolkit.Maui.Sample; public static class MauiProgram { + [RequiresUnreferencedCode($"{nameof(CommunityToolkit.Maui.Views.Expander)} and {nameof(TouchBehaviorCollectionViewMultipleSelectionPage)} are not type safe")] public static MauiApp CreateMauiApp() { var builder = MauiApp.CreateBuilder() @@ -68,8 +69,16 @@ public static MauiApp CreateMauiApp() .UseMauiCommunityToolkitCamera() .UseMauiCommunityToolkitMediaElement() + .ConfigureMauiHandlers(handlers => + { +#if IOS || MACCATALYST + handlers.AddHandler(); + handlers.AddHandler(); +#endif + }) + #if WINDOWS - .UseMauiCommunityToolkitMaps("KEY") // You should add your own key here from bingmapsportal.com + .UseMauiCommunityToolkitMaps("KEY") // You should add your own key here from https://bingmapsportal.com #else .UseMauiMaps() #endif @@ -112,6 +121,7 @@ public static MauiApp CreateMauiApp() builder.Services.AddHttpClient() .AddStandardResilienceHandler(static options => options.Retry = new MobileHttpRetryStrategyOptions()); + builder.Services.AddSingleton(); builder.Services.AddSingleton(); RegisterViewsAndViewModels(builder.Services); @@ -124,6 +134,7 @@ public static MauiApp CreateMauiApp() return builder.Build(); } + [RequiresUnreferencedCode("Calls CommunityToolkit.Maui.Sample.MauiProgram.AddTransientWithShellRoute()")] static void RegisterViewsAndViewModels(in IServiceCollection services) { // Add Gallery Pages + ViewModels diff --git a/samples/CommunityToolkit.Maui.Sample/Pages/Alerts/AlertsGalleryPage.cs b/samples/CommunityToolkit.Maui.Sample/Pages/Alerts/AlertsGalleryPage.cs index fdf18c116f..7e40a465eb 100644 --- a/samples/CommunityToolkit.Maui.Sample/Pages/Alerts/AlertsGalleryPage.cs +++ b/samples/CommunityToolkit.Maui.Sample/Pages/Alerts/AlertsGalleryPage.cs @@ -2,7 +2,7 @@ namespace CommunityToolkit.Maui.Sample.Pages.Alerts; -public class AlertsGalleryPage(IDeviceInfo deviceInfo, AlertsGalleryViewModel alertsGalleryViewModel) : BaseGalleryPage("Alerts", deviceInfo, alertsGalleryViewModel) +public partial class AlertsGalleryPage(IDeviceInfo deviceInfo, AlertsGalleryViewModel alertsGalleryViewModel) : BaseGalleryPage("Alerts", deviceInfo, alertsGalleryViewModel) { } \ No newline at end of file diff --git a/samples/CommunityToolkit.Maui.Sample/Pages/Alerts/SnackbarPage.xaml b/samples/CommunityToolkit.Maui.Sample/Pages/Alerts/SnackbarPage.xaml index da56fa9ba7..e8a00d0720 100644 --- a/samples/CommunityToolkit.Maui.Sample/Pages/Alerts/SnackbarPage.xaml +++ b/samples/CommunityToolkit.Maui.Sample/Pages/Alerts/SnackbarPage.xaml @@ -27,7 +27,7 @@ @@ -30,11 +32,13 @@ diff --git a/samples/CommunityToolkit.Maui.Sample/Pages/Behaviors/IconTintColorBehaviorPage.xaml b/samples/CommunityToolkit.Maui.Sample/Pages/Behaviors/IconTintColorBehaviorPage.xaml index 47914bbaba..1eb91f8f7a 100644 --- a/samples/CommunityToolkit.Maui.Sample/Pages/Behaviors/IconTintColorBehaviorPage.xaml +++ b/samples/CommunityToolkit.Maui.Sample/Pages/Behaviors/IconTintColorBehaviorPage.xaml @@ -75,9 +75,12 @@ Grid.Row="4" Grid.Column="1" Command="{Binding ToggleImageButtonCommand, Mode=OneTime}" - Source="{Binding ToggleableImageSource}"> + Source="{Binding ToggleableImageSource}" + x:Name="ToggleImageSourceButton"> - + @@ -85,9 +88,12 @@ Grid.Row="4" Grid.Column="2" Command="{Binding ChangeColorCommand}" - Source="shield.png"> + Source="shield.png" + x:Name="ShieldButton"> - + diff --git a/samples/CommunityToolkit.Maui.Sample/Pages/Behaviors/MaxLengthReachedBehaviorPage.xaml b/samples/CommunityToolkit.Maui.Sample/Pages/Behaviors/MaxLengthReachedBehaviorPage.xaml index 7509a58804..41aadb5467 100644 --- a/samples/CommunityToolkit.Maui.Sample/Pages/Behaviors/MaxLengthReachedBehaviorPage.xaml +++ b/samples/CommunityToolkit.Maui.Sample/Pages/Behaviors/MaxLengthReachedBehaviorPage.xaml @@ -20,8 +20,9 @@ Margin="{StaticResource ContentPadding}" /> - + - +