Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
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 .github/workflows/benchmarks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ on:
- '*'

env:
LATEST_NET_VERSION: '9.0.x'
LATEST_NET_VERSION: '10.0.x'
PathToCommunityToolkitBenchmarkCsproj: 'src/CommunityToolkit.Maui.Markup.Benchmarks/CommunityToolkit.Maui.Markup.Benchmarks.csproj'

concurrency:
Expand Down Expand Up @@ -42,7 +42,7 @@ jobs:
uses: actions/setup-dotnet@v5
with:
dotnet-version: ${{ env.LATEST_NET_VERSION }}
dotnet-quality: 'ga'
dotnet-quality: 'preview'

- name: Install .NET MAUI Workload
run: |
Expand Down
12 changes: 6 additions & 6 deletions .github/workflows/dotnet-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,15 @@ env:
# When we create a tag, we set the NuGet version to the tag number, the below values are only for PR builds.
CurrentSemanticVersionBase: '99.0.0' # Only used for PR builds
NugetPackageVersion: '99.0.0-preview${{ github.run_number }}' # Only used for PR builds
NET_VERSION: '9.0.x'
NET_VERSION: '10.0.x'
RunPoliCheck: false
PathToLibrarySolution: 'src/CommunityToolkit.Maui.Markup.sln'
PathToSamplesSolution: 'samples/CommunityToolkit.Maui.Markup.Sample.sln'
PathToCommunityToolkitCsproj: 'src/CommunityToolkit.Maui.Markup/CommunityToolkit.Maui.Markup.csproj'
PathToCommunityToolkitSampleCsproj: 'samples/CommunityToolkit.Maui.Markup.Sample/CommunityToolkit.Maui.Markup.Sample.csproj'
PathToCommunityToolkitUnitTestCsproj: 'src/CommunityToolkit.Maui.Markup.UnitTests/CommunityToolkit.Maui.Markup.UnitTests.csproj'
PathToCommunityToolkitSourceGeneratorsCsproj: 'src/CommunityToolkit.Maui.Markup.SourceGenerators/CommunityToolkit.Maui.Markup.SourceGenerators.csproj'
Xcode_Version: '16.3'
Xcode_Version: '26.0.1'
ShouldCheckDependencies: true

concurrency:
Expand Down Expand Up @@ -55,7 +55,7 @@ jobs:
uses: actions/setup-dotnet@v5
with:
dotnet-version: ${{ env.NET_VERSION }}
dotnet-quality: 'ga'
dotnet-quality: 'preview'

- uses: actions/setup-java@v5
with:
Expand Down Expand Up @@ -112,7 +112,7 @@ jobs:
uses: actions/setup-dotnet@v5
with:
dotnet-version: ${{ env.NET_VERSION }}
dotnet-quality: 'ga'
dotnet-quality: 'preview'

- uses: actions/setup-java@v5
with:
Expand Down Expand Up @@ -206,7 +206,7 @@ jobs:
uses: actions/setup-dotnet@v5
with:
dotnet-version: ${{ env.NET_VERSION }}
dotnet-quality: 'ga'
dotnet-quality: 'preview'

- name: Download NuGet List
uses: actions/download-artifact@v5
Expand Down Expand Up @@ -259,7 +259,7 @@ jobs:
uses: actions/setup-dotnet@v5
with:
dotnet-version: ${{ env.NET_VERSION }}
dotnet-quality: 'ga'
dotnet-quality: 'preview'

- name: Download signed packages for ${{ matrix.platform }}
uses: actions/download-artifact@v5
Expand Down
10 changes: 5 additions & 5 deletions Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
<Project>
<PropertyGroup>
<Nullable>enable</Nullable>
<NoWarn>NETSDK1023</NoWarn>
<NetVersion>net9.0</NetVersion>
<NoWarn>NETSDK1023;XCODE_26_0_PREVIEW</NoWarn>
<NetVersion>net10.0</NetVersion>
<LangVersion>preview</LangVersion>
<ImplicitUsings>enable</ImplicitUsings>
<EnforceCodeStyleInBuild>true</EnforceCodeStyleInBuild>
Expand All @@ -20,8 +20,8 @@
<NuGetAuditMode>all</NuGetAuditMode>

<!-- MAUI Specific -->
<MauiPackageVersion>9.0.60</MauiPackageVersion>
<NextMauiPackageVersion>10.0.0</NextMauiPackageVersion>
<MauiPackageVersion>10.0.0-rc.2.25504.7</MauiPackageVersion>
<NextMauiPackageVersion>11.0.0</NextMauiPackageVersion>
<MauiCommunityToolkitPackageVersion>11.2.0</MauiCommunityToolkitPackageVersion>
<MauiStrictXamlCompilation>true</MauiStrictXamlCompilation>
<SkipValidateMauiImplicitPackageReferences>true</SkipValidateMauiImplicitPackageReferences>
Expand Down Expand Up @@ -91,7 +91,7 @@
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,
IL2120,IL2121,IL2122,IL2123,
IL3050,IL3051,IL3052,IL3053,IL3054,IL3055,IL3056,
RS1038
</WarningsAsErrors>
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": "9.0.203",
"version": "10.0.100-rc.2.25502.107",
"rollForward": "latestFeature",
"allowPrerelease": false
"allowPrerelease": true
}
}
1 change: 0 additions & 1 deletion samples/CommunityToolkit.Maui.Markup.Sample/AppShell.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

namespace CommunityToolkit.Maui.Markup.Sample;

[RequiresUnreferencedCode("SettingsViewModel Calls CommunityToolkit.Maui.Behaviors.NumericValidationBehavior.NumericValidationBehavior()")]
partial class AppShell : Shell
{
static readonly ReadOnlyDictionary<Type, string> pageRouteMappingDictionary = new Dictionary<Type, string>(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,13 @@
<NoWarn>CsWinRT1028</NoWarn>
</PropertyGroup>

<PropertyGroup Condition="'$(Configuration)' == 'Release' &#xD;&#xA; AND $([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) != 'tizen'&#xD;&#xA; AND $([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) != 'android'&#xD;&#xA; AND $([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) != 'windows'">
<!-- Ahead-of-time compilation is not yet supported net8.0-tizen -->
<!-- Cross-OS native compilation is not supported net8.0-android -->
<!-- Windows causing build errors in azurepipelines.yml -->
<PublishAot>true</PublishAot>
<PropertyGroup Condition="'$(Configuration)' == 'Release'
AND $([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) != 'windows'">
<!-- Windows error NETSDK1102: Optimizing assemblies for size is not supported for the selected publish configuration. -->

<PublishAot>false</PublishAot>
<PublishTrimmed>true</PublishTrimmed>
<TrimMode>partial</TrimMode>
</PropertyGroup>

<ItemGroup>
Expand Down Expand Up @@ -75,4 +77,8 @@
</PropertyGroup>
</Target>

<ItemGroup>
<TrimmerRootAssembly Include="CommunityToolkit.Maui" RootMode="All"/>
</ItemGroup>

</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
using System.Diagnostics.CodeAnalysis;
namespace CommunityToolkit.Maui.Markup.Sample;

[RequiresUnreferencedCode("AppShell.GetRoute Requires Unreferenced Code")]
class HotReloadHandler : ICommunityToolkitHotReloadHandler
{
public async void OnHotReload(IReadOnlyList<Type> types)
Expand Down
4 changes: 1 addition & 3 deletions samples/CommunityToolkit.Maui.Markup.Sample/MauiProgram.cs
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
using System.Diagnostics.CodeAnalysis;
using Microsoft.Extensions.Http.Resilience;
using Microsoft.Extensions.Http.Resilience;
using Polly;
using Refit;
namespace CommunityToolkit.Maui.Markup.Sample;

[RequiresUnreferencedCode("SettingsViewModel Calls CommunityToolkit.Maui.Behaviors.NumericValidationBehavior.NumericValidationBehavior()")]
public class MauiProgram
{
public static MauiApp CreateMauiApp()
Expand Down
12 changes: 3 additions & 9 deletions samples/CommunityToolkit.Maui.Markup.Sample/Pages/NewsPage.cs
Original file line number Diff line number Diff line change
@@ -1,13 +1,10 @@
using System.Diagnostics.CodeAnalysis;

namespace CommunityToolkit.Maui.Markup.Sample.Pages;
namespace CommunityToolkit.Maui.Markup.Sample.Pages;

sealed partial class NewsPage : BaseContentPage<NewsViewModel>
{
readonly IDispatcher dispatcher;
readonly RefreshView refreshView;

[RequiresUnreferencedCode("AppShell.GetRoute Requires Unreferenced Code")]
public NewsPage(IDispatcher dispatcher,
NewsViewModel newsViewModel) : base(newsViewModel, "Top Stories")
{
Expand Down Expand Up @@ -49,7 +46,6 @@ protected override void OnAppearing()
static bool IsNullOrEmpty(in IEnumerable? enumerable) => !enumerable?.GetEnumerator().MoveNext() ?? true;
}

[RequiresUnreferencedCode("AppShell.GetRoute Requires Unreferenced Code")]
async void HandleSelectionChanged(object? sender, SelectionChangedEventArgs e)
{
ArgumentNullException.ThrowIfNull(sender);
Expand All @@ -65,13 +61,13 @@ async void HandleSelectionChanged(object? sender, SelectionChangedEventArgs e)
}
else
{
await DisplayAlert("Invalid Article", "ASK HN articles have no url", "OK");
await DisplayAlertAsync("Invalid Article", "ASK HN articles have no url", "OK");
}
}
}

async void HandlePullToRefreshFailed(object? sender, string message) =>
await dispatcher.DispatchAsync(() => DisplayAlert("Refresh Failed", message, "OK"));
await dispatcher.DispatchAsync(() => DisplayAlertAsync("Refresh Failed", message, "OK"));

bool TryRefreshCollectionView()
{
Expand All @@ -86,14 +82,12 @@ bool TryRefreshCollectionView()

void HandleNumberOfTopStoriesToFetchChanged(object? sender, int e) => TryRefreshCollectionView();

[RequiresUnreferencedCode("AppShell.GetRoute Requires Unreferenced Code")]
Task NavigateToSettingsPage() => dispatcher.DispatchAsync(() =>
{
var route = AppShell.GetRoute<SettingsPage, SettingsViewModel>();
return Shell.Current.GoToAsync(route);
});

[RequiresUnreferencedCode("AppShell.GetRoute Requires Unreferenced Code")]
Task NavigateToNewsDetailPage(StoryModel storyModel) => dispatcher.DispatchAsync(() =>
{
var route = AppShell.GetRoute<NewsDetailPage, NewsDetailViewModel>();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
using System.Diagnostics.CodeAnalysis;
using Microsoft.Maui.Layouts;
using Microsoft.Maui.Layouts;

namespace CommunityToolkit.Maui.Markup.Sample.Pages;

sealed partial class SettingsPage : BaseContentPage<SettingsViewModel>
{
[RequiresUnreferencedCode("Calls CommunityToolkit.Maui.Behaviors.NumericValidationBehavior.NumericValidationBehavior()")]
public SettingsPage(SettingsViewModel settingsViewModel) : base(settingsViewModel, "Settings")
{
Content = new AbsoluteLayout
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
using System.Diagnostics.CodeAnalysis;
using Foundation;
using Foundation;
namespace CommunityToolkit.Maui.Markup.Sample;

[Register(nameof(AppDelegate))]
[RequiresUnreferencedCode("SettingsViewModel Calls CommunityToolkit.Maui.Behaviors.NumericValidationBehavior.NumericValidationBehavior()")]
public class AppDelegate : MauiUIApplicationDelegate
{
protected override MauiApp CreateMauiApp() => MauiProgram.CreateMauiApp();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
using System.Diagnostics.CodeAnalysis;
using Foundation;
using Foundation;
namespace CommunityToolkit.Maui.Markup.Sample;

[Register(nameof(AppDelegate))]
[RequiresUnreferencedCode("SettingsViewModel Calls CommunityToolkit.Maui.Behaviors.NumericValidationBehavior.NumericValidationBehavior()")]
public class AppDelegate : MauiUIApplicationDelegate
{
protected override MauiApp CreateMauiApp() => MauiProgram.CreateMauiApp();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
using System.Windows.Input;
using BindableObjectViews;
using CommunityToolkit.Maui.Markup.UnitTests.Base;
using NUnit.Framework;
namespace CommunityToolkit.Maui.Markup.UnitTests
Expand Down Expand Up @@ -672,40 +671,40 @@ public void BindDefaultPropertyWithInlineTwoWayParameterizedConvertAndPositional
[Test]
public void BindCommandWithDefaults()
{
var textCell = new TextCell();
var button = new Button();
var path = nameof(viewModel.Command);

textCell.BindCommand(path);
button.BindCommand(path);

BindingHelpers.AssertBindingExists(textCell, TextCell.CommandProperty, path);
BindingHelpers.AssertBindingExists(textCell, TextCell.CommandParameterProperty);
BindingHelpers.AssertBindingExists(button, Button.CommandProperty, path);
BindingHelpers.AssertBindingExists(button, Button.CommandParameterProperty);
}

[Test]
public void BindCommandWithoutParameter()
{
var textCell = new TextCell();
var button = new Button();
var path = nameof(viewModel.Command);

textCell.BindCommand(path, parameterPath: null);
button.BindCommand(path, parameterPath: null);

BindingHelpers.AssertBindingExists(textCell, TextCell.CommandProperty, path);
Assert.That(BindingHelpers.GetBinding(textCell, TextCell.CommandParameterProperty), Is.Null);
BindingHelpers.AssertBindingExists(button, Button.CommandProperty, path);
Assert.That(BindingHelpers.GetBinding(button, Button.CommandParameterProperty), Is.Null);
}

[Test]
public void BindCommandWithPositionalParameters()
{
var textCell = new TextCell();
var button = new Button();
object source = new ViewModel();
var path = nameof(viewModel.Command);
var parameterPath = nameof(viewModel.Id);
object parameterSource = new ViewModel();

textCell.BindCommand(path, source, parameterPath, parameterSource);
button.BindCommand(path, source, parameterPath, parameterSource);

BindingHelpers.AssertBindingExists(textCell, TextCell.CommandProperty, path, source: source);
BindingHelpers.AssertBindingExists(textCell, TextCell.CommandParameterProperty, parameterPath, source: parameterSource);
BindingHelpers.AssertBindingExists(button, Button.CommandProperty, path, source: source);
BindingHelpers.AssertBindingExists(button, Button.CommandParameterProperty, parameterPath, source: parameterSource);
}

[Test]
Expand Down Expand Up @@ -747,7 +746,6 @@ public void SupportDerivedElements()
.Assign(out DerivedFromLabel assignDerivedFromLabel),
Is.InstanceOf<DerivedFromLabel>());

Assert.That(new DerivedFromTextCell().BindCommand(nameof(viewModel.Command)), Is.InstanceOf<DerivedFromTextCell>());
Assert.That(assignDerivedFromLabel, Is.InstanceOf<DerivedFromLabel>());
});
}
Expand Down Expand Up @@ -803,8 +801,4 @@ sealed class ViewModel
class DerivedFromLabel : Label
{
}

class DerivedFromTextCell : TextCell
{
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
<PackageReference Include="Microsoft.Testing.Extensions.CodeCoverage" Version="17.14.2" />
<PackageReference Include="CommunityToolkit.Maui" Version="$(MauiCommunityToolkitPackageVersion)" />
<PackageReference Include="Microsoft.Maui.Controls" Version="$(MauiPackageVersion)"/>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.14.1" />
</ItemGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
using CommunityToolkit.Maui.Markup.UnitTests.Base;
using CommunityToolkit.Maui.Markup.UnitTests.Mocks;
using NUnit.Framework;
namespace CommunityToolkit.Maui.Markup.UnitTests;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
using CommunityToolkit.Maui.Markup.UnitTests.Base;
using CommunityToolkit.Maui.Markup.UnitTests.Mocks;
using NUnit.Framework;
namespace CommunityToolkit.Maui.Markup.UnitTests;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,23 +51,23 @@ public void BindCommandThrowsArgumentNullExceptionWhenParameterHandlersNull()
[Test]
public void BindCommandWithDefaults()
{
var textCell = new TextCell
var textCell = new Button
{
BindingContext = viewModel
};

textCell.BindCommand(static (ViewModel vm) => vm.Command);

BindingHelpers.AssertTypedBindingExists(textCell, TextCell.CommandProperty, BindingMode.Default, viewModel);
Assert.That(BindingHelpers.GetBinding(textCell, TextCell.CommandParameterProperty), Is.Null);
BindingHelpers.AssertTypedBindingExists(textCell, Button.CommandProperty, BindingMode.Default, viewModel);
Assert.That(BindingHelpers.GetBinding(textCell, Button.CommandParameterProperty), Is.Null);
}

[Test]
public void BindCommandWithParameters()
{
ArgumentNullException.ThrowIfNull(viewModel);

var textCell = new TextCell
var textCell = new Button
{
BindingContext = viewModel
};
Expand All @@ -78,8 +78,8 @@ public void BindCommandWithParameters()
parameterGetter: static (ViewModel vm) => vm.Id,
parameterBindingMode: BindingMode.OneWay);

BindingHelpers.AssertTypedBindingExists(textCell, TextCell.CommandProperty, BindingMode.OneTime, viewModel);
BindingHelpers.AssertTypedBindingExists(textCell, TextCell.CommandParameterProperty, BindingMode.OneWay, viewModel);
BindingHelpers.AssertTypedBindingExists(textCell, Button.CommandProperty, BindingMode.OneTime, viewModel);
BindingHelpers.AssertTypedBindingExists(textCell, Button.CommandParameterProperty, BindingMode.OneWay, viewModel);

Assert.Multiple(() =>
{
Expand Down
Loading
Loading