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

Merged
merged 191 commits into from
Dec 18, 2024
Merged
Show file tree
Hide file tree
Changes from 13 commits
Commits
Show all changes
191 commits
Select commit Hold shift + click to select a range
c4169ed
Point to the .NET 9.0 release candidate
bijington Sep 18, 2024
e8e4c21
Tweak versions in the pipeline
bijington Sep 18, 2024
0223b47
allow prerelease builds
bijington Sep 18, 2024
24f1026
Find overlapping versions for AnxroidX libraries
bijington Sep 18, 2024
616ca9c
Fix null reference type issue
bijington Sep 18, 2024
590d8df
Shift to TypedBindings
bijington Sep 18, 2024
39df165
Keep disabling IL2092 for NET9_0
bijington Sep 18, 2024
39de8a0
Mark types as Dynamically accessed
bijington Sep 18, 2024
51dc62d
Merge branch 'main' into feature/sl-dotnet-nine
TheCodeTraveler Sep 19, 2024
9514390
Patch up Analyzer unit tests
bijington Sep 19, 2024
5677465
Fix the AvatarView unit tests
bijington Sep 19, 2024
0e90207
Suppress warning disable IL2026
bijington Sep 19, 2024
0674abf
Update comments in Camera project
bijington Sep 19, 2024
446ed60
Update src/CommunityToolkit.Maui.Analyzers.UnitTests/Verifiers/CSharp…
bijington Sep 19, 2024
7e02482
Update src/CommunityToolkit.Maui.Analyzers.UnitTests/Verifiers/CSharp…
bijington Sep 19, 2024
8f1ab91
Include preview builds for benchmarks
bijington Sep 19, 2024
18e5892
Merge branch 'feature/sl-dotnet-nine' of github.com:CommunityToolkit/…
bijington Sep 19, 2024
d430867
Remove Obsolete code
TheCodeTraveler Sep 19, 2024
bb378bd
Remove pragma now that unsafe code has been removed
TheCodeTraveler Sep 19, 2024
92213aa
Update ICommunityToolkitBehavior.shared.cs
TheCodeTraveler Sep 19, 2024
dce03ba
Update Expander.shared.cs
TheCodeTraveler Sep 19, 2024
bc7d67b
`MainPage` -> `Windows[0].Page`
TheCodeTraveler Sep 19, 2024
6d80b85
use `override CreateWindow(IActivationState)` to initialize AppShell
TheCodeTraveler Sep 23, 2024
0756b7a
Increase to Xcode 16
TheCodeTraveler Sep 26, 2024
a9e6143
Make use of a TypedBinding instance to workaround current limitations
bijington Oct 2, 2024
7a42193
Merge branch 'main' into feature/sl-dotnet-nine
bijington Oct 2, 2024
9303b48
Remove ifdef
TheCodeTraveler Oct 4, 2024
de624c6
Enable `NuGetAudit`
TheCodeTraveler Oct 14, 2024
39d1408
Add WarningsAsErrors for `NuGetAudit`
TheCodeTraveler Oct 14, 2024
8dec573
Merge branch 'main' into feature/sl-dotnet-nine
TheCodeTraveler Oct 15, 2024
83ba19a
Remove Obsolete PopupService method
TheCodeTraveler Oct 15, 2024
8bdbc6f
Update for .NET 9 RC 2
TheCodeTraveler Oct 15, 2024
4dbaf75
Merge branch 'main' into feature/sl-dotnet-nine
TheCodeTraveler Oct 15, 2024
189c16d
Update Android dependencies
TheCodeTraveler Oct 15, 2024
5daf804
Remove unrequired NuGet Packages
TheCodeTraveler Oct 15, 2024
b66ae83
Fix Vulnerabilities
TheCodeTraveler Oct 15, 2024
9be58a7
Merge branch 'main' into feature/sl-dotnet-nine
TheCodeTraveler Oct 15, 2024
c0b7a6e
Resolve NuGet Dependency Conflicts
TheCodeTraveler Oct 15, 2024
552c31c
Remove reflection
TheCodeTraveler Oct 16, 2024
e1e3f5e
Fix `Camera` Android Dependencies
TheCodeTraveler Oct 16, 2024
9a0b537
Refactor return statement
TheCodeTraveler Oct 16, 2024
2f20c4a
Fix nullability error
TheCodeTraveler Oct 16, 2024
6f2817c
Merge branch 'feature/sl-dotnet-nine' of https://github.com/Community…
TheCodeTraveler Oct 16, 2024
1996cd5
Update AppShell.xaml
TheCodeTraveler Oct 16, 2024
e5bc87b
Increase to RC2
TheCodeTraveler Oct 16, 2024
b6841ce
Use `static`
TheCodeTraveler Oct 16, 2024
ecc7d50
Merge branch 'main' into feature/sl-dotnet-nine
TheCodeTraveler Oct 16, 2024
e119e53
Use `private protected` constructor
TheCodeTraveler Oct 16, 2024
f2a36fd
Stop automatically assigning Behavior BindingContext
TheCodeTraveler Oct 16, 2024
a9d4d38
Merge branch 'feature/sl-dotnet-nine' of https://github.com/Community…
TheCodeTraveler Oct 16, 2024
7c004e4
Remove References to `TrySetBindingContextToAttachedViewBindingContext`
TheCodeTraveler Oct 16, 2024
a5f0e86
Update BaseBehaviorTest.cs
TheCodeTraveler Oct 16, 2024
c2bbb86
Refactor GravatarImageSource
TheCodeTraveler Oct 16, 2024
0bae474
Update CommunityToolkit.Maui.Sample.csproj
TheCodeTraveler Oct 16, 2024
cf4e34c
Merge branch 'feature/sl-dotnet-nine' of https://github.com/Community…
TheCodeTraveler Oct 16, 2024
3210586
Update for CsWinRT1028, CsWinRT1030, XC0045, and XC0103
TheCodeTraveler Oct 16, 2024
0594549
Use `partial` for source generators
TheCodeTraveler Oct 16, 2024
298e12b
Use Syntax Highlighting for code blocks
TheCodeTraveler Oct 16, 2024
eddf68f
Removed duplicate string
TheCodeTraveler Oct 16, 2024
df98a42
Remove References to Application.Current.MainPage
TheCodeTraveler Oct 16, 2024
0251dcf
Fix typos
TheCodeTraveler Oct 16, 2024
47fcdd8
Update samples/CommunityToolkit.Maui.Sample/CommunityToolkit.Maui.Sam…
TheCodeTraveler Oct 16, 2024
f6cddbd
Update samples/CommunityToolkit.Maui.Sample/Pages/Views/Expander/Expa…
TheCodeTraveler Oct 16, 2024
7d0d182
Fix Find + Replace typo
TheCodeTraveler Oct 16, 2024
cdfba47
Remove unused namespace
TheCodeTraveler Oct 16, 2024
05dd7ec
Remove `MainPage`
TheCodeTraveler Oct 16, 2024
c917bd0
Add BindingContext to Behaviors in Sample App
TheCodeTraveler Oct 17, 2024
ce8deb8
Increase Android SupportedOSPlatformVersion to 26
TheCodeTraveler Oct 17, 2024
1f9c06d
Fix XAML Warnings
TheCodeTraveler Oct 17, 2024
0272350
Use `macos-15-arm64`
TheCodeTraveler Oct 27, 2024
32ecaab
Update azure-pipelines.yml
TheCodeTraveler Oct 27, 2024
26d43e1
Use Xcode version `16`
TheCodeTraveler Oct 27, 2024
72857ba
Revert back to macOS14
TheCodeTraveler Oct 27, 2024
eb6ac01
Merge branch 'main' into feature/sl-dotnet-nine
jfversluis Oct 31, 2024
810b69c
Use BindingMode.OneWay
TheCodeTraveler Oct 31, 2024
7b52c4a
Fix PopupService Tests
TheCodeTraveler Oct 31, 2024
8bfc313
Fix AvatarView Tests
TheCodeTraveler Oct 31, 2024
813c143
Fix AvatarView Tests
TheCodeTraveler Oct 31, 2024
43ffcdb
Fix ParentWindowTests
TheCodeTraveler Oct 31, 2024
3c1acca
Resolve AppTheme Tests
TheCodeTraveler Oct 31, 2024
d2b9d8b
Add `[RequiresUnreferencedCode]` attribute to `ValidationBehavior`
TheCodeTraveler Nov 1, 2024
bb36172
Update BehaviorsGalleryPage.cs
TheCodeTraveler Nov 1, 2024
c762fb2
`dotnet format`
TheCodeTraveler Nov 1, 2024
6aedd2e
Remove `Obsolete` attributes from `dotnet format`
TheCodeTraveler Nov 1, 2024
2cd0c7a
Update `Microsoft.CodeAnalysis.CSharp.Workspaces`
TheCodeTraveler Nov 4, 2024
ac437a6
Update Sample App NuGet Packages to .NET 9
TheCodeTraveler Nov 4, 2024
e3e6211
Remove Duplicate NuGet Packages
TheCodeTraveler Nov 4, 2024
b916b28
Merge branch 'main' into feature/sl-dotnet-nine
TheCodeTraveler Nov 5, 2024
c19b3d6
Fix https://github.com/CommunityToolkit/Maui/issues/2109
TheCodeTraveler Nov 5, 2024
b4869b7
Fix CameraView warnings
TheCodeTraveler Nov 5, 2024
2dd57b5
Refactor ShowKeyboardAsync
TheCodeTraveler Nov 5, 2024
27e218e
Refactor Code + Performance Improvements
TheCodeTraveler Nov 5, 2024
928b19f
`dotnet format`
TheCodeTraveler Nov 5, 2024
4284967
Remove unused using directives
TheCodeTraveler Nov 5, 2024
3ef7ef9
Add `[EditorBrowsable(EditorBrowsableState.Never)]`
TheCodeTraveler Nov 5, 2024
a983d56
Use `BindingBase.Create`
TheCodeTraveler Nov 6, 2024
8d54b5e
Merge branch 'main' into feature/sl-dotnet-nine
TheCodeTraveler Nov 6, 2024
8e00d1c
Update Options.cs
TheCodeTraveler Nov 6, 2024
800dd72
Merge branch 'main' into feature/sl-dotnet-nine
TheCodeTraveler Nov 7, 2024
e066f17
Renaming and changing ValidationFlags.ValidateOnFocus and ValidateOnU…
CliffAgius Nov 7, 2024
7713aab
Fix compiled bindings For MediaElement
ne0rrmatrix Nov 8, 2024
01575bb
Fix Windows crash on exiting Page or Application when using Media Ele…
ne0rrmatrix Nov 8, 2024
fdd8168
Remove trace log added by accident
ne0rrmatrix Nov 8, 2024
5924b2a
Fix `MultiValidationBehavior` compiled bindings
ne0rrmatrix Nov 8, 2024
9d63b86
Fix `MultiConverterPage` Compiled Bindings
ne0rrmatrix Nov 8, 2024
36b6b72
Remove `x:DataType` from several lines
ne0rrmatrix Nov 8, 2024
95b2ff1
Add using to enable support for logging
ne0rrmatrix Nov 8, 2024
23fe7c9
Merge branch 'main' into feature/sl-dotnet-nine
TheCodeTraveler Nov 8, 2024
2248d70
Fix `ColorsConverterPage` compiled bindings. This casts the `x:DataTy…
ne0rrmatrix Nov 8, 2024
da066cd
Set `x:DataType` in `AppShell.xaml` to support compiled bindings
ne0rrmatrix Nov 9, 2024
752e8a1
Update `LazyViewPage` to add support for compiled bindings
ne0rrmatrix Nov 9, 2024
0fdb280
Update `EmailValidationBehaviorPage` to support Compiled bindings
ne0rrmatrix Nov 9, 2024
e538eed
Update params collections
TheCodeTraveler Nov 10, 2024
0eb39a8
Update Xcode logic
TheCodeTraveler Nov 10, 2024
7d609a1
Update azure-pipelines.yml
TheCodeTraveler Nov 10, 2024
8cb078c
Update azure-pipelines.yml
TheCodeTraveler Nov 10, 2024
6e5c417
Update azure-pipelines.yml
TheCodeTraveler Nov 10, 2024
2238534
Increase to macOS-15
TheCodeTraveler Nov 11, 2024
67a7caf
Add SourceLink
TheCodeTraveler Nov 11, 2024
a3a83aa
Update CommunityToolkit.Maui.Sample.csproj
TheCodeTraveler Nov 11, 2024
0260cef
Merge branch 'main' into feature/sl-dotnet-nine
TheCodeTraveler Nov 11, 2024
7065b2d
Update PopupServiceTests.cs
TheCodeTraveler Nov 11, 2024
5bda93d
Resolve Failing DrawingView Unit Tests
TheCodeTraveler Nov 11, 2024
b0c9ee0
Use Partial Properties
TheCodeTraveler Nov 12, 2024
f4fb321
Support `CarouselViewHandler2` + `CollectionViewHandler2` for MediaEl…
TheCodeTraveler Nov 12, 2024
700a82b
Update comment text
TheCodeTraveler Nov 12, 2024
503cf4e
Update for .NET 9 GA
TheCodeTraveler Nov 12, 2024
8bd0184
Update samples/CommunityToolkit.Maui.Sample/CommunityToolkit.Maui.Sam…
TheCodeTraveler Nov 12, 2024
cc5a669
Add `x:DataType` for Compiled Bindings
TheCodeTraveler Nov 12, 2024
acf646c
Update NuGet Packages
TheCodeTraveler Nov 12, 2024
90b6baa
Remove reference
TheCodeTraveler Nov 12, 2024
5762236
Update CommunityToolkit.Maui.Sample.csproj
TheCodeTraveler Nov 12, 2024
1d524c3
Sort alphabetically
TheCodeTraveler Nov 12, 2024
f30f541
Set Behavior BindingContext
TheCodeTraveler Nov 12, 2024
660c27d
Merge branch 'feature/sl-dotnet-nine' of https://github.com/Community…
TheCodeTraveler Nov 12, 2024
bd8d383
Enable IServiceProvider
TheCodeTraveler Nov 12, 2024
89eb97b
Fix compareconverter demo
TheCodeTraveler Nov 12, 2024
6c5816e
Fix Crash
TheCodeTraveler Nov 12, 2024
bdc00fc
Fix Behavior Binding
TheCodeTraveler Nov 12, 2024
28a9e54
Add Behavior BindingContext
TheCodeTraveler Nov 12, 2024
e1fdb07
Add behavior BindingContext
TheCodeTraveler Nov 12, 2024
6363975
Fix DrawingView sample
TheCodeTraveler Nov 13, 2024
ded531f
Use Enum.IsDefined<T>
TheCodeTraveler Nov 13, 2024
e2fc7e7
Fix Expander Binding
TheCodeTraveler Nov 13, 2024
67fb9a4
Update Maps for async/await + Trimming
TheCodeTraveler Nov 13, 2024
9fce650
Catch Element Not Found Exception
TheCodeTraveler Nov 13, 2024
d53c847
Modify CompareConverter signature to match IsInRangeConverter
bijington Nov 13, 2024
f043544
Update Directory.Build.props
TheCodeTraveler Nov 14, 2024
0e991c2
run `dotnet workload update` following `dotnet workload install maui`
TheCodeTraveler Nov 14, 2024
c240aea
Update azure-pipelines.yml
TheCodeTraveler Nov 15, 2024
7d2f431
Revert "Update azure-pipelines.yml"
TheCodeTraveler Nov 15, 2024
c84e785
Use Primary Constructor, Update Formatting
TheCodeTraveler Nov 15, 2024
bfb9629
Disable warnings on compiler-generated code
TheCodeTraveler Nov 15, 2024
b96594e
Prevent Usage with Microsoft.Maui.Controls v10.0.0+
TheCodeTraveler Nov 17, 2024
e8a1d5f
Organize Build props
TheCodeTraveler Nov 17, 2024
0029b45
Add `[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.All)]`
TheCodeTraveler Nov 17, 2024
cb41208
Merge branch 'main' into feature/sl-dotnet-nine
TheCodeTraveler Nov 17, 2024
3f31948
Merge branch 'main' into feature/sl-dotnet-nine
TheCodeTraveler Nov 20, 2024
f802f5f
Update NuGet Packages
TheCodeTraveler Nov 22, 2024
9841ee0
Add `//lang=csharp` to raw string literals
TheCodeTraveler Nov 26, 2024
69eee10
Implement `TheoryData`
TheCodeTraveler Nov 26, 2024
d723a14
Use `field` keyword
TheCodeTraveler Nov 26, 2024
074baa2
Add Xunit Usage Analyzers
TheCodeTraveler Nov 26, 2024
662c5ed
Add Xunit Assertion Analyzers
TheCodeTraveler Nov 26, 2024
71f0a02
Add Xunit Extensibility Analyzers
TheCodeTraveler Nov 26, 2024
a79e8cf
Resolve Trimming Errors
TheCodeTraveler Nov 26, 2024
ccc8392
Bump Xcode to 16.1
TheCodeTraveler Nov 27, 2024
8171c1e
Update NuGet Packages
TheCodeTraveler Dec 4, 2024
ab225ae
Add removed rules
TheCodeTraveler Dec 4, 2024
7b3181b
Bump Windows-specific NuGet Packages
TheCodeTraveler Dec 4, 2024
8134fa7
Add `FluentAssertions.Analyzers`
TheCodeTraveler Dec 4, 2024
5780553
Bump TOOLKIT_NET_VERSION to `9.0.101`
TheCodeTraveler Dec 7, 2024
315b32c
Merge branch 'main' into feature/sl-dotnet-nine
TheCodeTraveler Dec 8, 2024
c4e129b
Update NuGet Packages
TheCodeTraveler Dec 12, 2024
8355bae
Fix typo
TheCodeTraveler Dec 12, 2024
1401cc9
Update Directory.Build.props
TheCodeTraveler Dec 12, 2024
62be665
Opt-out of using managed-static for MacCatalyst
bijington Dec 17, 2024
087cbec
Update `xunit.runner.visualstudio`
TheCodeTraveler Dec 17, 2024
ff923c1
Remove duplicate paranthesis
TheCodeTraveler Dec 17, 2024
05846be
Remove AutoFixture
TheCodeTraveler Dec 17, 2024
906d00b
Update to `xunit.v3`
TheCodeTraveler Dec 17, 2024
a88d5b0
Increase minimum required .NET SDK Version
TheCodeTraveler Dec 17, 2024
5acc97e
Fix Snackbar in Modal Page on Android
TheCodeTraveler Dec 17, 2024
8208f17
Fix Snackbar alignment on iOS
TheCodeTraveler Dec 17, 2024
a6a783e
Fix bindings
TheCodeTraveler Dec 17, 2024
b8d29a9
Improve Android Build Times
TheCodeTraveler Dec 17, 2024
c3b79e1
Fix typo
TheCodeTraveler Dec 17, 2024
b444803
Fix crash on iOS due to `null`
TheCodeTraveler Dec 17, 2024
7a71dae
Use Partial Properties
TheCodeTraveler Dec 18, 2024
2a66903
Fix Android NavigationBar
TheCodeTraveler Dec 18, 2024
6d726d0
`dotnet format`
TheCodeTraveler Dec 18, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions Directory.Build.props
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<Project>
<PropertyGroup>
<NetVersion>net8.0</NetVersion>
<MauiPackageVersion>8.0.71</MauiPackageVersion>
<NetVersion>net9.0</NetVersion>
<MauiPackageVersion>9.0.0-rc.1.24453.9</MauiPackageVersion>
<LangVersion>latest</LangVersion>
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
Expand Down
8 changes: 4 additions & 4 deletions azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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.100-rc.1.24452.12'
LATEST_NET_VERSION: '9.0.x'
PathToLibrarySolution: 'src/CommunityToolkit.Maui.sln'
PathToSamplesSolution: 'samples/CommunityToolkit.Maui.Sample.sln'
PathToCommunityToolkitCsproj: 'src/CommunityToolkit.Maui/CommunityToolkit.Maui.csproj'
Expand Down Expand Up @@ -76,7 +76,7 @@ jobs:
inputs:
packageType: 'sdk'
version: '$(LATEST_NET_VERSION)'
includePreviewVersions: false
includePreviewVersions: true

- task: CmdLine@2
displayName: 'Install Latest .NET MAUI Workload'
Expand Down Expand Up @@ -206,7 +206,7 @@ jobs:
inputs:
packageType: 'sdk'
version: '$(TOOLKIT_NET_VERSION)'
includePreviewVersions: false
includePreviewVersions: true

- task: CmdLine@2
displayName: 'Install .NET MAUI Workload $(TOOLKIT_NET_VERSION)'
Expand Down
4 changes: 2 additions & 2 deletions global.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"sdk": {
"version": "8.0.303",
"version": "9.0.100-rc.1.24452.12",
"rollForward": "latestFeature",
"allowPrerelease": false
"allowPrerelease": true
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ public Test(params Type[] assembliesUnderTest)
{
#if NET8_0
ReferenceAssemblies = Microsoft.CodeAnalysis.Testing.ReferenceAssemblies.Net.Net80;
#elif NET9_0
ReferenceAssemblies = Microsoft.CodeAnalysis.Testing.ReferenceAssemblies.Net.Net90;
#else
#error ReferenceAssemblies must be updated to current version of .NET
#endif
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ public Test(params Type[] assembliesUnderTest)
{
#if NET8_0
ReferenceAssemblies = ReferenceAssemblies.Net.Net80;
#elif NET9_0
ReferenceAssemblies = ReferenceAssemblies.Net.Net90;
#else
#error ReferenceAssemblies must be updated to current version of .NET
#endif
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,23 +51,25 @@
</ItemGroup>

<ItemGroup Condition="$(TargetFramework.Contains('-android'))">
<PackageReference Include="Xamarin.AndroidX.Camera.View" Version="1.3.1.1" />
<PackageReference Include="Xamarin.AndroidX.Camera.Camera2" Version="1.3.1.1" />
<PackageReference Include="Xamarin.AndroidX.Camera.View" Version="1.3.4.1" />
<PackageReference Include="Xamarin.AndroidX.Camera.Camera2" Version="1.3.4.1" />

<!-- Xamarin.AndroidX.Camera 1.3.1.1 depends on Xamarin.AndroidX.Lifecycle.LiveData 2.7.0.1:
<!-- Xamarin.AndroidX.Camera 1.3.4.1 depends on Xamarin.AndroidX.Lifecycle.LiveData 2.8.4.0:
https://www.nuget.org/packages/Xamarin.AndroidX.Camera.Core/#dependencies-body-tab
However, Dotnet MAUI still implicitly references Xamarin.AndroidX.Lifecycle.LiveData 2.6.1.3:
However, Dotnet MAUI still implicitly references Xamarin.AndroidX.Lifecycle.LiveData 2.8.3.1:
https://github.com/dotnet/maui/blob/main/eng/AndroidX.targets
This causes build error "Detected package downgrade":
https://learn.microsoft.com/en-us/nuget/reference/errors-and-warnings/nu1605
Workaround: add a package reference to the higher version of the package. Possibly can be removed when MAUI bumps the implicit reference version.
-->
<PackageReference Include="Xamarin.AndroidX.Lifecycle.LiveData" Version="2.7.0.1" />
<PackageReference Include="Xamarin.AndroidX.Lifecycle.Common" Version="2.8.4.0" />
<PackageReference Include="Xamarin.AndroidX.Lifecycle.LiveData" Version="2.8.4.0" />
<PackageReference Include="Xamarin.AndroidX.Lifecycle.LiveData.Core" Version="2.8.4.0" />

<!--Adding the above package reference requires Workaround for https://github.com/xamarin/AndroidX/issues/800#issuecomment-1774639627 -->
<!-- Tracking issue https://github.com/xamarin/AndroidX/issues/764 -->
<PackageReference Include="Xamarin.AndroidX.Collection" Version="1.4.0.1" />
<PackageReference Include="Xamarin.AndroidX.Collection.Ktx" Version="1.4.0.1" />
<PackageReference Include="Xamarin.AndroidX.Collection" Version="1.4.3.1" />
<PackageReference Include="Xamarin.AndroidX.Collection.Ktx" Version="1.4.3.1" />
</ItemGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ public void ConstructorTest()
avatarView.TextColor.Should().Be(Colors.Pink);
avatarView.Text.Should().Be("GL");
avatarView.TextTransform.Should().Be(TextTransform.Lowercase);
Size request = avatarView.Measure(double.PositiveInfinity, double.PositiveInfinity).Request;
Size request = avatarView.Measure(double.PositiveInfinity, double.PositiveInfinity);
request.Width.Should().Be(10);
request.Height.Should().Be(20);
}
Expand Down Expand Up @@ -191,7 +191,7 @@ public void DefaultFontSize()
public void DefaultHeightRequest()
{
var avatarView = new Maui.Views.AvatarView();
Size request = avatarView.Measure(double.PositiveInfinity, double.PositiveInfinity).Request;
Size request = avatarView.Measure(double.PositiveInfinity, double.PositiveInfinity);
request.Height.Should().Be(AvatarViewDefaults.DefaultHeightRequest);
}

Expand Down Expand Up @@ -228,7 +228,7 @@ public void DefaultProperties()
public void DefaultWidthRequest()
{
var avatarView = new Maui.Views.AvatarView();
Size request = avatarView.Measure(double.PositiveInfinity, double.PositiveInfinity).Request;
Size request = avatarView.Measure(double.PositiveInfinity, double.PositiveInfinity);
request.Width.Should().Be(AvatarViewDefaults.DefaultWidthRequest);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,9 @@ public class EventToCommandBehavior : BaseBehavior<VisualElement>
public static readonly BindableProperty EventArgsConverterProperty =
BindableProperty.Create(nameof(EventArgsConverter), typeof(IValueConverter), typeof(EventToCommandBehavior));

#pragma warning disable IL2026 // NET9.0 - check if this can be fixed
readonly MethodInfo eventHandlerMethodInfo = typeof(EventToCommandBehavior).GetTypeInfo().GetDeclaredMethod(nameof(OnTriggerHandled)) ?? throw new InvalidOperationException($"Cannot find method {nameof(OnTriggerHandled)}");
#pragma warning restore IL2026

Delegate? eventHandler;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,13 @@ internal bool TrySetBindingContextToAttachedViewBindingContext()
return false;
}

#pragma warning disable IL2026 // NET9.0 - check if this can be fixed
behavior.SetBinding(BindableObject.BindingContextProperty, new Binding
{
Source = View,
Path = BindableObject.BindingContextProperty.PropertyName
});
#pragma warning restore IL2026

return true;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -346,11 +346,13 @@ async Task OnValuePropertyChanged(CancellationToken token)

void OnValuePropertyNamePropertyChanged()
{
#pragma warning disable IL2026 // NET9.0 - check if this can be fixed
SetBinding(ValueProperty, new Binding
{
Path = ValuePropertyName,
Source = View
});
#pragma warning restore IL2026
}

async ValueTask UpdateStateAsync(VisualElement? view, ValidationFlags flags, bool isForced, CancellationToken? parentToken = null)
Expand Down Expand Up @@ -410,13 +412,8 @@ async ValueTask UpdateStateAsync(VisualElement? view, ValidationFlags flags, boo
void UpdateStyle(in VisualElement view, bool isValid)
{
VisualStateManager.GoToState(view, isValid ? ValidVisualState : InvalidVisualState);

if ((ValidStyle ?? InvalidStyle) == null)
{
return;
}

view.Style = isValid ? ValidStyle : InvalidStyle;

view.Style = (isValid ? ValidStyle : InvalidStyle) ?? view.Style;
}

void ResetValidationTokenSource(CancellationTokenSource? newTokenSource)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ public interface ICommunityToolkitValueConverter : IValueConverter


/// <inheritdoc />
#if NET8_0 // Should be fixed in .NET 9
#if NET8_0 || NET9_0 // Should be fixed in .NET 9 - Not fixed in the first RC
#pragma warning disable IL2092
#endif
object? IValueConverter.Convert(object? value, [DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicParameterlessConstructor)] Type targetType, object? parameter, CultureInfo culture) =>
Expand All @@ -61,7 +61,7 @@ public interface ICommunityToolkitValueConverter : IValueConverter
/// <inheritdoc />
object? IValueConverter.ConvertBack(object? value, [DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicParameterlessConstructor)] Type targetType, object? parameter, CultureInfo culture) =>
ConvertBack(value, targetType, parameter, culture);
#if NET8_0
#if NET8_0 || NET9_0
#pragma warning restore IL2092
#endif
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ namespace CommunityToolkit.Maui.Converters;
public sealed class IsInRangeConverter : IsInRangeConverter<IComparable, object>;

/// <summary>Converts the incoming value to a <see cref="bool"/> indicating whether or not the value is within a range.</summary>
public abstract class IsInRangeConverter<[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicMethods)] TValue, TReturnObject> : BaseConverterOneWay<TValue, object> where TValue : IComparable
public abstract class IsInRangeConverter<[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicMethods | DynamicallyAccessedMemberTypes.PublicParameterlessConstructor)] TValue, [DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicMethods | DynamicallyAccessedMemberTypes.PublicParameterlessConstructor)] TReturnObject> : BaseConverterOneWay<TValue, object> where TValue : IComparable
{
/// <summary>
/// Bindable property for <see cref="FalseObject"/>
Expand Down
4 changes: 2 additions & 2 deletions src/CommunityToolkit.Maui/Converters/MultiConverter.shared.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ public class MultiConverter : List<ICommunityToolkitValueConverter>, ICommunityT
[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicParameterlessConstructor)]
Type ICommunityToolkitValueConverter.ToType => throw new NotSupportedException($"{nameof(ICommunityToolkitMultiValueConverter)} does not implement {nameof(ICommunityToolkitValueConverter.ToType)}");

#if NET8_0 // Should be fixed in .NET 9
#if NET8_0 || NET9_0 // Should be fixed in .NET 9
#pragma warning disable IL2092
#endif
/// <summary>
Expand All @@ -44,7 +44,7 @@ public class MultiConverter : List<ICommunityToolkitValueConverter>, ICommunityT
/// <returns>N/A</returns>
public object? ConvertBack(object? value, [DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicParameterlessConstructor)] Type targetType, object? parameter, System.Globalization.CultureInfo? culture)
=> throw new NotSupportedException("Impossible to revert to original value. Consider setting BindingMode to OneWay.");
#if NET8_0 // Should be fixed in .NET 9
#if NET8_0 || NET9_0 // Should be fixed in .NET 9
#pragma warning restore IL2092
#endif
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
namespace CommunityToolkit.Maui.ImageSources;
using Microsoft.Maui.Controls.Internals;

namespace CommunityToolkit.Maui.ImageSources;

using CommunityToolkit.Maui.Extensions;
using Microsoft.Maui.Controls;
Expand Down Expand Up @@ -143,8 +145,8 @@ protected override void OnParentSet()
return;
}

SetBinding(ParentWidthProperty, new Binding(nameof(VisualElement.Width), BindingMode.OneWay, source: parentElement));
SetBinding(ParentHeightProperty, new Binding(nameof(VisualElement.Height), BindingMode.OneWay, source: parentElement));
SetBinding(ParentWidthProperty, BindingBase.Create<VisualElement, double>(static p => p.Width, source: parentElement));
SetBinding(ParentHeightProperty, BindingBase.Create<VisualElement, double>(static p => p.Height, source: parentElement));
}

static string DefaultGravatarName(DefaultImage defaultGravatar) => defaultGravatar switch
Expand Down
4 changes: 2 additions & 2 deletions src/CommunityToolkit.Maui/Views/AvatarView.shared.cs
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,8 @@ public AvatarView()
CornerRadius = new CornerRadius(AvatarViewDefaults.DefaultCornerRadius.TopLeft, AvatarViewDefaults.DefaultCornerRadius.TopRight, AvatarViewDefaults.DefaultCornerRadius.BottomLeft, AvatarViewDefaults.DefaultCornerRadius.BottomRight),
};
Content = avatarLabel;
avatarImage.SetBinding(WidthRequestProperty, new Binding(nameof(WidthRequest), source: this));
avatarImage.SetBinding(HeightRequestProperty, new Binding(nameof(HeightRequest), source: this));
avatarImage.SetBinding(WidthRequestProperty, BindingBase.Create<VisualElement, double>(static p => p.WidthRequest, source: this));
avatarImage.SetBinding(HeightRequestProperty, BindingBase.Create<VisualElement, double>(static p => p.HeightRequest, source: this));
}

/// <summary>Gets or sets the control font.</summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ static void OnContentPropertyChanged(BindableObject bindable, object oldValue, o
var expander = (Expander)bindable;
if (newValue is View view)
{
view.SetBinding(IsVisibleProperty, new Binding(nameof(IsExpanded), source: bindable));
view.SetBinding(IsVisibleProperty, BindingBase.Create<Expander, bool>(static p => p.IsExpanded, source: expander));

expander.ContentGrid.Remove(oldValue);
expander.ContentGrid.Add(newValue);
Expand Down
Loading