diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile index 6935449fd..4afefc902 100644 --- a/.devcontainer/Dockerfile +++ b/.devcontainer/Dockerfile @@ -1,5 +1,5 @@ # See https://github.com/devcontainers/images/tree/main/src/dotnet for image choices -FROM mcr.microsoft.com/vscode/devcontainers/dotnet:9.0 +FROM mcr.microsoft.com/devcontainers/dotnet:10.0 # [Choice] Node.js version: none, lts/*, 16, 14, 12, 10 ARG NODE_VERSION="none" diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index da7c1a47f..040cb75fb 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -5,10 +5,6 @@ "build": { "dockerfile": "Dockerfile", "args": { - // Update 'VARIANT' to pick a .NET Core version: 3.1, 5.0, 6.0 - // Append -bullseye or -focal to pin to an OS version. - "VARIANT": "9.0", - // Options "NODE_VERSION": "lts/*" } }, diff --git a/.github/instructions/components.instructions.md b/.github/instructions/components.instructions.md index 0de2cb28f..ebf23c8b6 100644 --- a/.github/instructions/components.instructions.md +++ b/.github/instructions/components.instructions.md @@ -15,7 +15,6 @@ applyTo: "components/**,catalog/**,tools/**" - Run `check` and the tests on a tree without sample build output: building a sample project copies its `*.md`/`*.xaml.cs` into `components/*/samples/bin`, which the exporter does not exclude, so both then fail with "sample id ... is already declared". Delete that output first (see the validation skill's clean-up). - `dotnet test tools/SampleIndexExporter.Tests` (also run by CI) is stricter than `check`: it also fails on unreferenced `[ToolkitSample]`s, withheld samples and sample-less docs missing from its allow-list (`CoverageTests`). - An entry id is the slug of the *markdown file name*, must be unique across all components (a collision is an error) and is published as a stable id: renaming a docs file changes it. -- The exporter and its tests target a runtime older than the SDK in `global.json`. If it is not installed, set `$env:DOTNET_ROLL_FORWARD='Major'` (persists for the session) before `dotnet run`/`dotnet test`. ## `tools/` - The CI job for `tools/` does not check out `tooling/` or install workloads, so these projects must not reference `tooling/` or WinUI/Uno. diff --git a/.github/skills/validate-component-changes/SKILL.md b/.github/skills/validate-component-changes/SKILL.md index a3e862a99..7fb46cce4 100644 --- a/.github/skills/validate-component-changes/SKILL.md +++ b/.github/skills/validate-component-changes/SKILL.md @@ -9,7 +9,7 @@ Mirrors `.github/workflows/build.yml`; run from the repo root on Windows. Read ` ## Prerequisites - `msbuild.exe` from Visual Studio on `PATH` (Developer shell, or prepend `\MSBuild\Current\Bin\amd64`); otherwise `GenerateSingleSolution.ps1` waits for a keypress. `vstest.console.exe` lives in `\Common7\IDE\CommonExtensions\Microsoft\TestWindow`. -- `dotnet tool restore` once. Build requirements are in `tooling/ReadMe.md` (the root `ReadMe.md` is out of date); CI runs `uno-check` for every leg except `wasdk`, `wpf` and `linuxgtk`. +- `dotnet tool restore` once. Build requirements are in `ReadMe.md` and `tooling/ReadMe.md`; CI runs `uno-check` for every leg except `wasdk`, `wpf` and `linuxgtk`. - If nuget.org is unreachable, restore fails; revert any local feed override in `nuget.config` before committing. ## 1. Fast loop: one component diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 6a4b21e5f..c138ee026 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -17,7 +17,7 @@ on: merge_group: env: - DOTNET_VERSION: '9.0.310' # Only used by jobs that cannot access global.json (no checkout/artifact-only jobs) + DOTNET_VERSION: '10.0.402' # Only used by jobs that cannot access global.json (no checkout/artifact-only jobs) ENABLE_DIAGNOSTICS: true MSBUILD_VERBOSITY: normal #COREHOST_TRACE: 1 @@ -170,7 +170,7 @@ jobs: - name: Add msbuild to PATH uses: microsoft/setup-msbuild@v2 with: - vs-version: '[17.13,)' + vs-version: '[18.0,)' # Generate full solution with all projects (sample gallery heads, components, tests) - name: Generate solution with ${{ matrix.multitarget }} gallery, components and tests @@ -193,7 +193,7 @@ jobs: - name: Run SourceGenerators tests id: test-generator - run: vstest.console.exe ./tooling/CommunityToolkit.Tooling.SampleGen.Tests/bin/Release/net8.0/CommunityToolkit.Tooling.SampleGen.Tests.dll /logger:"trx;LogFileName=SourceGenerators.trx" + run: vstest.console.exe ./tooling/CommunityToolkit.Tooling.SampleGen.Tests/bin/Release/net10.0/CommunityToolkit.Tooling.SampleGen.Tests.dll /logger:"trx;LogFileName=SourceGenerators.trx" - name: Start Procdump monitoring for first-chance exceptions if: ${{ (matrix.multitarget == 'uwp' || matrix.multitarget == 'wasdk') && env.ENABLE_DIAGNOSTICS == 'true' }} @@ -313,7 +313,7 @@ jobs: - name: Add msbuild to PATH uses: microsoft/setup-msbuild@v2 with: - vs-version: '[17.13,)' + vs-version: '[18.0,)' # Build and pack component nupkg (WinUI 2 only builds uwp, WinUI 3 builds wasdk and all Uno targets) - name: Build and pack component packages diff --git a/Directory.Build.targets b/Directory.Build.targets index 504ca9c9a..18bac4bf6 100644 --- a/Directory.Build.targets +++ b/Directory.Build.targets @@ -1,8 +1,4 @@ - - - - $(CommonTags);UWP;WinUI;Platform;WindowsAppSDK;WASDK;WinAppSDK;Universal $(CommonTags);Uno diff --git a/ReadMe.md b/ReadMe.md index 466a6ca4d..643241356 100644 --- a/ReadMe.md +++ b/ReadMe.md @@ -48,12 +48,12 @@ Building something cool? Want to engage with other developers? Want to contribut ### 1. Set up the environment > [!NOTE] -> The Windows Community Toolkit requires [Visual Studio 2022](https://visualstudio.microsoft.com/vs/) or later to build and Windows 10 or later to execute. If you're building an app with WinUI and Windows App SDK for the first time, follow these [installation instructions](https://learn.microsoft.com/windows/apps/get-started/start-here). +> The Windows Community Toolkit requires [Visual Studio 2026](https://visualstudio.microsoft.com/vs/) or later and the [.NET 10 SDK](https://dotnet.microsoft.com/download/dotnet/10.0) (version specified in `global.json`) to build and Windows 10 or later to execute. If you're building an app with WinUI and Windows App SDK for the first time, follow these [installation instructions](https://learn.microsoft.com/windows/apps/get-started/start-here). **Required [Visual Studio components](https://learn.microsoft.com/windows/apps/get-started/start-here?tabs=vs-2022-17-10#required-workloads-and-components):** - Windows application development - .NET desktop development -- Windows 10 SDK, version 2004 (10.0.19041.0) +- Windows SDK 26100 (10.0.26100.0) - Windows 10 21H1 (Build 19043) or greater ### 2. Clone the repository @@ -66,7 +66,7 @@ git clone --recurse-submodules https://github.com/CommunityToolkit/Windows.git ### 3. Run build scripts & open solution - Run `dotnet tool restore` from the project root to install the .NET tools used by the build scripts -- Run `tooling\GenerateAllSolution.ps1` from the project root to generate `CommunityToolkit.AllComponents.slnx` (opening `.slnx` files requires Visual Studio 2022 17.13 or later, or the .NET 9 SDK or later) +- Run `tooling\GenerateAllSolution.ps1` from the project root to generate `CommunityToolkit.AllComponents.slnx` (opening `.slnx` files requires Visual Studio 2026 or the .NET 10 SDK) - Run build scripts from the [Developer Command Prompt for Visual Studio](https://learn.microsoft.com/visualstudio/ide/reference/command-prompt-powershell) or from elsewhere after adding `MSBuild.exe` to your PATH diff --git a/components/Animations/src/Xaml/Abstract/Animation{TValue,TKeyFrame}.cs b/components/Animations/src/Xaml/Abstract/Animation{TValue,TKeyFrame}.cs index cc98af6e0..611042b11 100644 --- a/components/Animations/src/Xaml/Abstract/Animation{TValue,TKeyFrame}.cs +++ b/components/Animations/src/Xaml/Abstract/Animation{TValue,TKeyFrame}.cs @@ -91,7 +91,7 @@ public IList> KeyFrames /// public override AnimationBuilder AppendToBuilder(AnimationBuilder builder, TimeSpan? delayHint, TimeSpan? durationHint, EasingType? easingTypeHint, EasingMode? easingModeHint) { - default(ArgumentNullException).ThrowIfNull(ExplicitTarget); + ArgumentNullException.ThrowIfNull(ExplicitTarget); return builder.NormalizedKeyFrames This, EasingType? EasingTypeHint, EasingMode? EasingModeHint)>( property: ExplicitTarget, diff --git a/components/Animations/src/Xaml/Abstract/CustomAnimation{TValue,TKeyFrame}.cs b/components/Animations/src/Xaml/Abstract/CustomAnimation{TValue,TKeyFrame}.cs index 201a88657..74f9028ce 100644 --- a/components/Animations/src/Xaml/Abstract/CustomAnimation{TValue,TKeyFrame}.cs +++ b/components/Animations/src/Xaml/Abstract/CustomAnimation{TValue,TKeyFrame}.cs @@ -43,7 +43,7 @@ public abstract class CustomAnimation : ImplicitAnimation public override AnimationBuilder AppendToBuilder(AnimationBuilder builder, TimeSpan? delayHint, TimeSpan? durationHint, EasingType? easingTypeHint, EasingMode? easingModeHint) { - default(ArgumentNullException).ThrowIfNull(ExplicitTarget); + ArgumentNullException.ThrowIfNull(ExplicitTarget); return builder.NormalizedKeyFrames This, EasingType? EasingTypeHint, EasingMode? EasingModeHint)>( property: ExplicitTarget, diff --git a/components/Animations/src/Xaml/Abstract/ImplicitAnimation{TValue,TKeyFrame}.cs b/components/Animations/src/Xaml/Abstract/ImplicitAnimation{TValue,TKeyFrame}.cs index f5c1fb774..7ae8ce476 100644 --- a/components/Animations/src/Xaml/Abstract/ImplicitAnimation{TValue,TKeyFrame}.cs +++ b/components/Animations/src/Xaml/Abstract/ImplicitAnimation{TValue,TKeyFrame}.cs @@ -46,7 +46,7 @@ protected ImplicitAnimation() /// public CompositionAnimation GetAnimation(UIElement element, out string? target) { - default(ArgumentNullException).ThrowIfNull(ExplicitTarget); + ArgumentNullException.ThrowIfNull(ExplicitTarget); NormalizedKeyFrameAnimationBuilder.Composition builder = new( ExplicitTarget, diff --git a/components/Behaviors/samples/Behaviors.Samples.csproj b/components/Behaviors/samples/Behaviors.Samples.csproj index 54c8f0b21..d27428865 100644 --- a/components/Behaviors/samples/Behaviors.Samples.csproj +++ b/components/Behaviors/samples/Behaviors.Samples.csproj @@ -8,6 +8,15 @@ + + + $(NoWarn);IL2026 + + diff --git a/components/Extensions/src/ArgumentNullExceptionExtensions.cs b/components/Extensions/src/ArgumentNullExceptionExtensions.cs deleted file mode 100644 index 545654bfb..000000000 --- a/components/Extensions/src/ArgumentNullExceptionExtensions.cs +++ /dev/null @@ -1,65 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -using System.Diagnostics.CodeAnalysis; -using System.Runtime.CompilerServices; - -namespace System; - -/// -/// Throw helper extensions for . -/// -internal static class ArgumentNullExceptionExtensions -{ - /// - /// Throws an for a given parameter name. - /// - /// Dummy value to invoke the extension upon (always pass . - /// The name of the parameter to report in the exception. - /// Thrown with . - [DoesNotReturn] - public static void Throw(this ArgumentNullException? _, string? parameterName) - { - throw new ArgumentNullException(parameterName); - } - - /// - /// Throws an if is . - /// - /// Dummy value to invoke the extension upon (always pass . - /// The reference type argument to validate as non-. - /// The name of the parameter with which corresponds. - /// Thrown if is . - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static void ThrowIfNull(this ArgumentNullException? _, [NotNull] object? argument, [CallerArgumentExpression(nameof(argument))] string? parameterName = null) - { - if (argument is null) - { - Throw(parameterName); - } - } - - /// - /// Throws an if is . - /// - /// Dummy value to invoke the extension upon (always pass . - /// The pointer argument to validate as non-. - /// The name of the parameter with which corresponds. - /// Thrown if is . - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static unsafe void ThrowIfNull(this ArgumentNullException? _, [NotNull] void* argument, [CallerArgumentExpression(nameof(argument))] string? parameterName = null) - { - if (argument is null) - { - Throw(parameterName); - } - } - - /// - [DoesNotReturn] - private static void Throw(string? parameterName) - { - throw new ArgumentNullException(parameterName); - } -} diff --git a/components/Extensions/src/CommunityToolkit.WinUI.Extensions.csproj b/components/Extensions/src/CommunityToolkit.WinUI.Extensions.csproj index d233d2c63..c9c9d0b5e 100644 --- a/components/Extensions/src/CommunityToolkit.WinUI.Extensions.csproj +++ b/components/Extensions/src/CommunityToolkit.WinUI.Extensions.csproj @@ -25,8 +25,7 @@ - - + diff --git a/components/Extensions/src/Markup/FontIconExtension.cs b/components/Extensions/src/Markup/FontIconExtension.cs index 987046668..5c8faacb4 100644 --- a/components/Extensions/src/Markup/FontIconExtension.cs +++ b/components/Extensions/src/Markup/FontIconExtension.cs @@ -23,7 +23,7 @@ public partial class FontIconExtension : TextIconExtension /// protected override object ProvideValue() { - default(ArgumentNullException).ThrowIfNull(Glyph); + ArgumentNullException.ThrowIfNull(Glyph); var fontIcon = new FontIcon { diff --git a/components/Media/src/Effects/Extensions/ImageSourceExtension.cs b/components/Media/src/Effects/Extensions/ImageSourceExtension.cs index 011a5caff..55314fd29 100644 --- a/components/Media/src/Effects/Extensions/ImageSourceExtension.cs +++ b/components/Media/src/Effects/Extensions/ImageSourceExtension.cs @@ -14,7 +14,7 @@ public sealed partial class ImageSourceExtension : ImageSourceBaseExtension /// protected override object ProvideValue() { - default(ArgumentNullException).ThrowIfNull(Uri); + ArgumentNullException.ThrowIfNull(Uri); return PipelineBuilder.FromImage(Uri, DpiMode, CacheMode); } } diff --git a/components/Media/src/Effects/Extensions/TileSourceExtension.cs b/components/Media/src/Effects/Extensions/TileSourceExtension.cs index 95269f683..bb7f78eac 100644 --- a/components/Media/src/Effects/Extensions/TileSourceExtension.cs +++ b/components/Media/src/Effects/Extensions/TileSourceExtension.cs @@ -15,7 +15,7 @@ public sealed partial class TileSourceExtension : ImageSourceBaseExtension /// protected override object ProvideValue() { - default(ArgumentNullException).ThrowIfNull(Uri); + ArgumentNullException.ThrowIfNull(Uri); return PipelineBuilder.FromTiles(Uri, DpiMode, CacheMode); } } diff --git a/components/Media/src/Helpers/SurfaceLoader.Instance.cs b/components/Media/src/Helpers/SurfaceLoader.Instance.cs index d480c46c1..c6aa23f34 100644 --- a/components/Media/src/Helpers/SurfaceLoader.Instance.cs +++ b/components/Media/src/Helpers/SurfaceLoader.Instance.cs @@ -155,7 +155,7 @@ public async Task LoadFromUri(Uri uri) /// public async Task LoadFromUri(Uri uri, Size sizeTarget) { - default(ArgumentNullException).ThrowIfNull(compositionDevice); + ArgumentNullException.ThrowIfNull(compositionDevice); var bitmap = await CanvasBitmap.LoadAsync(canvasDevice, uri); var sizeSource = bitmap.Size; @@ -190,7 +190,7 @@ public async Task LoadFromUri(Uri uri, Size sizeTarge /// public CompositionDrawingSurface LoadText(string text, Size sizeTarget, CanvasTextFormat textFormat, Color textColor, Color bgColor) { - default(ArgumentNullException).ThrowIfNull(compositionDevice); + ArgumentNullException.ThrowIfNull(compositionDevice); var surface = compositionDevice.CreateDrawingSurface( sizeTarget, @@ -215,7 +215,7 @@ public CompositionDrawingSurface LoadText(string text, Size sizeTarget, CanvasTe /// public async Task LoadFromUri(Uri uri, Size sizeTarget, LoadTimeEffectHandler loadEffectHandler) { - default(ArgumentNullException).ThrowIfNull(compositionDevice); + ArgumentNullException.ThrowIfNull(compositionDevice); if (loadEffectHandler != null) { diff --git a/components/SettingsControls/samples/SettingsControls.Samples.csproj b/components/SettingsControls/samples/SettingsControls.Samples.csproj index de0e51d96..3fb442e30 100644 --- a/components/SettingsControls/samples/SettingsControls.Samples.csproj +++ b/components/SettingsControls/samples/SettingsControls.Samples.csproj @@ -9,6 +9,15 @@ + + + $(NoWarn);IL2026 + + diff --git a/tooling b/tooling index 138b77424..c0018820c 160000 --- a/tooling +++ b/tooling @@ -1 +1 @@ -Subproject commit 138b77424b3db9e4c223917477b965c7db66f862 +Subproject commit c0018820c570e14b7ea0d7ae86fcd57a88277989 diff --git a/tools/SampleIndexExporter.Tests/SampleIndexExporter.Tests.csproj b/tools/SampleIndexExporter.Tests/SampleIndexExporter.Tests.csproj index ee68e390a..f4faf86a4 100644 --- a/tools/SampleIndexExporter.Tests/SampleIndexExporter.Tests.csproj +++ b/tools/SampleIndexExporter.Tests/SampleIndexExporter.Tests.csproj @@ -2,7 +2,7 @@ - net9.0 + net10.0 CommunityToolkit.SampleIndex.Tests CommunityToolkit.SampleIndexExporter.Tests enable diff --git a/tools/SampleIndexExporter/SampleIndexExporter.csproj b/tools/SampleIndexExporter/SampleIndexExporter.csproj index 7439ee2e0..739bfc0a4 100644 --- a/tools/SampleIndexExporter/SampleIndexExporter.csproj +++ b/tools/SampleIndexExporter/SampleIndexExporter.csproj @@ -8,7 +8,7 @@ never loads WinUI. Keeping it platform-agnostic means the staleness check can run as a fast standalone CI job instead of waiting on the Uno/WinUI build matrix. --> - net9.0 + net10.0 CommunityToolkit.SampleIndex CommunityToolkit.SampleIndexExporter enable