From 91f6e7ba43be30df709a6fce6ed4a1b3fbb1ae06 Mon Sep 17 00:00:00 2001 From: Claude Date: Mon, 24 Nov 2025 17:50:20 +0000 Subject: [PATCH 01/13] Upgrade to .NET 10 - Add net10.0 target framework to main library - Update test project to net10.0 - Update Microsoft.Extensions package references to 10.0.0 - Update GitHub Actions workflow to use .NET 10 SDK - Update NuGet package source to dotnet10 --- .github/workflows/build.yml | 4 ++-- NuGet.Config | 2 +- src/Scrutor/Scrutor.csproj | 6 +++--- test/Scrutor.Tests/Scrutor.Tests.csproj | 4 ++-- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index e0a13f1e..8e5b9c0d 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -16,10 +16,10 @@ jobs: - name: Checkout uses: actions/checkout@v4 - - name: Setup .NET 9 SDK + - name: Setup .NET 10 SDK uses: actions/setup-dotnet@v4 with: - dotnet-version: "9.x" + dotnet-version: "10.x" - name: Test run: dotnet test --collect:"XPlat Code Coverage" diff --git a/NuGet.Config b/NuGet.Config index dbf0180d..6bd4065a 100644 --- a/NuGet.Config +++ b/NuGet.Config @@ -3,6 +3,6 @@ - + diff --git a/src/Scrutor/Scrutor.csproj b/src/Scrutor/Scrutor.csproj index b43c51b4..7318546c 100644 --- a/src/Scrutor/Scrutor.csproj +++ b/src/Scrutor/Scrutor.csproj @@ -3,7 +3,7 @@ Register services using assembly scanning and a fluent API. 6.1.0 Kristian Hellang - net462;netstandard2.0;net8.0 + net462;netstandard2.0;net8.0;net10.0 $(NoWarn);CS1591 latest enable @@ -35,7 +35,7 @@ - - + + diff --git a/test/Scrutor.Tests/Scrutor.Tests.csproj b/test/Scrutor.Tests/Scrutor.Tests.csproj index 6e958b51..2660b629 100644 --- a/test/Scrutor.Tests/Scrutor.Tests.csproj +++ b/test/Scrutor.Tests/Scrutor.Tests.csproj @@ -1,6 +1,6 @@  - net9.0 + net10.0 latest @@ -13,6 +13,6 @@ - + From 41b8a4b1f2a5eb2b0003a4485425db4865ae6c17 Mon Sep 17 00:00:00 2001 From: Claude Date: Mon, 24 Nov 2025 17:53:30 +0000 Subject: [PATCH 02/13] Upgrade tests to xUnit v3 with Microsoft Testing Platform - Replace xunit 2.9.2 with xunit.v3 1.0.0 - Remove Microsoft.NET.Test.Sdk, add Microsoft.Testing.Platform 1.4.3 - Add xunit.v3.runner.mstestadapter for new test platform integration - Enable Microsoft Testing Platform with EnableMicrosoftTestingPlatform property - Leverage native test platform support in .NET 10 --- test/Scrutor.Tests/Scrutor.Tests.csproj | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/test/Scrutor.Tests/Scrutor.Tests.csproj b/test/Scrutor.Tests/Scrutor.Tests.csproj index 2660b629..90ebee86 100644 --- a/test/Scrutor.Tests/Scrutor.Tests.csproj +++ b/test/Scrutor.Tests/Scrutor.Tests.csproj @@ -2,6 +2,7 @@ net10.0 latest + true @@ -9,9 +10,9 @@ - - - + + + From bb565647714f953c762398f4b2a4efb72a92d8a8 Mon Sep 17 00:00:00 2001 From: Claude Date: Mon, 24 Nov 2025 18:00:23 +0000 Subject: [PATCH 03/13] Fix xUnit v3 package references - Update xunit.v3 from 1.0.0 to 3.2.0 (latest stable) - Update Microsoft.Testing.Platform from 1.4.3 to 1.6.2 (minimum required) - Remove non-existent xunit.v3.runner.mstestadapter package (native support is built-in) - Remove coverlet.collector (replaced by Microsoft.Testing.Extensions.CodeCoverage) - Add Microsoft.Testing.Extensions.CodeCoverage 17.13.9 for code coverage support xUnit v3 has native Microsoft Testing Platform support built-in, so no separate runner adapter package is needed. --- test/Scrutor.Tests/Scrutor.Tests.csproj | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/test/Scrutor.Tests/Scrutor.Tests.csproj b/test/Scrutor.Tests/Scrutor.Tests.csproj index 90ebee86..3fafda40 100644 --- a/test/Scrutor.Tests/Scrutor.Tests.csproj +++ b/test/Scrutor.Tests/Scrutor.Tests.csproj @@ -10,10 +10,9 @@ - - - - + + + From 9e196d357dde9b66393d11f3155c8d313b506c3a Mon Sep 17 00:00:00 2001 From: Claude Date: Mon, 24 Nov 2025 18:02:46 +0000 Subject: [PATCH 04/13] Fix Microsoft Testing Platform configuration for .NET 10 - Replace invalid EnableMicrosoftTestingPlatform with TestingPlatformDotnetTestSupport - Add global.json to enable native .NET 10 SDK Microsoft.Testing.Platform support - Configure SDK version 10.0.100 with latestFeature roll-forward policy - Set test runner to Microsoft.Testing.Platform for optimal integration With .NET 10 SDK, Microsoft Testing Platform has native support that provides better integration and removes the need for VSTest compatibility layer. --- global.json | 9 +++++++++ test/Scrutor.Tests/Scrutor.Tests.csproj | 2 +- 2 files changed, 10 insertions(+), 1 deletion(-) create mode 100644 global.json diff --git a/global.json b/global.json new file mode 100644 index 00000000..1d364c6a --- /dev/null +++ b/global.json @@ -0,0 +1,9 @@ +{ + "sdk": { + "version": "10.0.100", + "rollForward": "latestFeature" + }, + "test": { + "runner": "Microsoft.Testing.Platform" + } +} diff --git a/test/Scrutor.Tests/Scrutor.Tests.csproj b/test/Scrutor.Tests/Scrutor.Tests.csproj index 3fafda40..fd6061c4 100644 --- a/test/Scrutor.Tests/Scrutor.Tests.csproj +++ b/test/Scrutor.Tests/Scrutor.Tests.csproj @@ -2,7 +2,7 @@ net10.0 latest - true + true From 0f030820175691ce51d6d733a9a42b1cf396e58b Mon Sep 17 00:00:00 2001 From: Claude Date: Mon, 24 Nov 2025 18:06:16 +0000 Subject: [PATCH 05/13] Fix package version conflicts - Update Microsoft.Testing.Platform from 1.6.2 to 1.9.0 (required by xunit.v3 3.2.0) - Update Microsoft.Testing.Extensions.CodeCoverage from 17.13.9 to 17.14.1 (latest available) xunit.v3 3.2.0 requires Microsoft.Testing.Platform >= 1.9.0, which was causing a package downgrade error. Updated to match the minimum required version. --- test/Scrutor.Tests/Scrutor.Tests.csproj | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/Scrutor.Tests/Scrutor.Tests.csproj b/test/Scrutor.Tests/Scrutor.Tests.csproj index fd6061c4..747e35a9 100644 --- a/test/Scrutor.Tests/Scrutor.Tests.csproj +++ b/test/Scrutor.Tests/Scrutor.Tests.csproj @@ -10,9 +10,9 @@ - + - + From c54b0b3a699e8dade50db77c6d63c78b6a654c70 Mon Sep 17 00:00:00 2001 From: Claude Date: Mon, 24 Nov 2025 18:08:35 +0000 Subject: [PATCH 06/13] Update to Microsoft.Testing.Platform 2.0.2 and CodeCoverage 18.1.0 - Update Microsoft.Testing.Platform from 1.9.0 to 2.0.2 (latest stable) - Update Microsoft.Testing.Extensions.CodeCoverage from 17.14.1 to 18.1.0 (latest stable) These are the latest versions compatible with xUnit v3 3.2.0 and .NET 10. --- test/Scrutor.Tests/Scrutor.Tests.csproj | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/Scrutor.Tests/Scrutor.Tests.csproj b/test/Scrutor.Tests/Scrutor.Tests.csproj index 747e35a9..0a9f75ee 100644 --- a/test/Scrutor.Tests/Scrutor.Tests.csproj +++ b/test/Scrutor.Tests/Scrutor.Tests.csproj @@ -10,9 +10,9 @@ - + - + From ce85447b31b9abc7b3392c21849900ad711797ad Mon Sep 17 00:00:00 2001 From: Claude Date: Mon, 24 Nov 2025 18:09:54 +0000 Subject: [PATCH 07/13] Add OutputType Exe for xUnit v3 Microsoft Testing Platform xUnit v3 test projects using Microsoft Testing Platform must be executable. This is required for the native test runner integration in .NET 10. The test project now builds as a console application that can be run directly or via 'dotnet test'. --- test/Scrutor.Tests/Scrutor.Tests.csproj | 1 + 1 file changed, 1 insertion(+) diff --git a/test/Scrutor.Tests/Scrutor.Tests.csproj b/test/Scrutor.Tests/Scrutor.Tests.csproj index 0a9f75ee..327e68d9 100644 --- a/test/Scrutor.Tests/Scrutor.Tests.csproj +++ b/test/Scrutor.Tests/Scrutor.Tests.csproj @@ -2,6 +2,7 @@ net10.0 latest + Exe true From 057a43837e3510276a9e69e4d50a672c146d7738 Mon Sep 17 00:00:00 2001 From: Claude Date: Mon, 24 Nov 2025 18:10:56 +0000 Subject: [PATCH 08/13] Update code coverage command for native Microsoft.Testing.Platform Replace VSTest-style command: --collect:"XPlat Code Coverage" With native Microsoft.Testing.Platform command for .NET 10: --coverage --coverage-output-format cobertura With .NET 10 SDK and native Microsoft.Testing.Platform support (configured in global.json), the new simplified command syntax is used. The extra -- is no longer needed, and code coverage is collected via the Microsoft.Testing.Extensions.CodeCoverage package we're referencing. --- .github/workflows/build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 8e5b9c0d..319455f5 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -22,7 +22,7 @@ jobs: dotnet-version: "10.x" - name: Test - run: dotnet test --collect:"XPlat Code Coverage" + run: dotnet test --coverage --coverage-output-format cobertura - name: Update codecov if: startsWith(github.repository, 'khellang/') From 1ff0f901713061e771c5bdbdf336f99d46d86aeb Mon Sep 17 00:00:00 2001 From: Claude Date: Mon, 24 Nov 2025 18:14:24 +0000 Subject: [PATCH 09/13] Fix xUnit v3 compatibility with Microsoft.Testing.Platform v2 Replace xunit.v3 with xunit.v3.mtp-v2 to explicitly target Microsoft.Testing.Platform v2.x. xUnit v3 3.2.0 introduced the ability to choose which major version of Microsoft Testing Platform to support: - xunit.v3 (default, uses MTP v1) - xunit.v3.mtp-v1 (explicitly uses MTP v1) - xunit.v3.mtp-v2 (explicitly uses MTP v2) - xunit.v3.mtp-off (disables MTP support) Since we're using Microsoft.Testing.Platform 2.0.2, we need the explicit MTP v2 variant to avoid type loading errors. --- test/Scrutor.Tests/Scrutor.Tests.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/Scrutor.Tests/Scrutor.Tests.csproj b/test/Scrutor.Tests/Scrutor.Tests.csproj index 327e68d9..a8e30f66 100644 --- a/test/Scrutor.Tests/Scrutor.Tests.csproj +++ b/test/Scrutor.Tests/Scrutor.Tests.csproj @@ -12,7 +12,7 @@ - + From cefbb0f7e26d6b9e4f8879eadb321ae5cf6a5b34 Mon Sep 17 00:00:00 2001 From: Claude Date: Mon, 24 Nov 2025 18:19:00 +0000 Subject: [PATCH 10/13] Fix codecov integration for Microsoft.Testing.Platform Update codecov action configuration: - Upgrade from codecov/codecov-action@v1 to @v5 - Add explicit files pattern: '**/TestResults/**/coverage.cobertura.xml' - Add CODECOV_TOKEN for authentication - Enable fail_ci_if_error to catch coverage upload issues Microsoft.Testing.Platform outputs coverage files to a different location than VSTest, so we need to explicitly specify the file pattern for codecov to find them. --- .github/workflows/build.yml | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 319455f5..eff84837 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -26,4 +26,9 @@ jobs: - name: Update codecov if: startsWith(github.repository, 'khellang/') - uses: codecov/codecov-action@v1 + uses: codecov/codecov-action@v5 + with: + files: '**/TestResults/**/coverage.cobertura.xml' + fail_ci_if_error: true + env: + CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} From dc83a909f697fd10b9b62d650cbf23ba31397817 Mon Sep 17 00:00:00 2001 From: Claude Date: Mon, 24 Nov 2025 18:22:47 +0000 Subject: [PATCH 11/13] Use dotnet-coverage tool for reliable code coverage collection Replace direct --coverage flags with dotnet-coverage wrapper tool: - Install dotnet-coverage as a global tool - Use 'dotnet-coverage collect' to wrap dotnet test command - Output directly to coverage.cobertura.xml in workspace root - Update codecov to look for coverage.cobertura.xml The dotnet-coverage tool provides more reliable coverage collection across different test frameworks and CI/CD environments. It wraps any .NET command and collects coverage data using the Microsoft Code Coverage engine. --- .github/workflows/build.yml | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index eff84837..b2675655 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -21,14 +21,17 @@ jobs: with: dotnet-version: "10.x" - - name: Test - run: dotnet test --coverage --coverage-output-format cobertura + - name: Install dotnet-coverage + run: dotnet tool install -g dotnet-coverage + + - name: Test with coverage + run: dotnet-coverage collect --output coverage.cobertura.xml --output-format cobertura "dotnet test" - name: Update codecov if: startsWith(github.repository, 'khellang/') uses: codecov/codecov-action@v5 with: - files: '**/TestResults/**/coverage.cobertura.xml' + files: coverage.cobertura.xml fail_ci_if_error: true env: CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} From 5e63979c0ab9149d018b03c100665fdbbc0d72a7 Mon Sep 17 00:00:00 2001 From: Claude Date: Mon, 24 Nov 2025 18:33:33 +0000 Subject: [PATCH 12/13] Fix codecov token configuration Move CODECOV_TOKEN from env to with.token parameter for codecov v5. Set fail_ci_if_error to false to prevent CI failures when codecov has issues uploading. Codecov action v5 expects the token to be passed as a parameter in the 'with:' section rather than as an environment variable. --- .github/workflows/build.yml | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index b2675655..8ca5f608 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -32,6 +32,5 @@ jobs: uses: codecov/codecov-action@v5 with: files: coverage.cobertura.xml - fail_ci_if_error: true - env: - CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} + token: ${{ secrets.CODECOV_TOKEN }} + fail_ci_if_error: false From 928698f8be200d5a5888880ec3496824a7fcec40 Mon Sep 17 00:00:00 2001 From: Claude Date: Mon, 24 Nov 2025 18:42:29 +0000 Subject: [PATCH 13/13] Enable deterministic builds for reproducible NuGet packages Add deterministic build properties to Scrutor.csproj: - Deterministic=true: Ensures compiler generates byte-for-byte identical outputs for the same inputs - ContinuousIntegrationBuild=true (when CI=true): Normalizes file paths and timestamps in PDB files for reproducible builds Add CI=true to GitHub Actions workflow to explicitly enable ContinuousIntegrationBuild in CI environments. These settings ensure that building the same source code multiple times will produce identical NuGet packages, which is important for: - Security (verifying package contents match source) - Build reproducibility - Package verification and attestation --- .github/workflows/build.yml | 1 + src/Scrutor/Scrutor.csproj | 3 +++ 2 files changed, 4 insertions(+) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 8ca5f608..b6b4f14c 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -8,6 +8,7 @@ jobs: if: "!contains(github.event.head_commit.message, '[skip ci]')" env: + CI: true DOTNET_SKIP_FIRST_TIME_EXPERIENCE: 1 DOTNET_CLI_TELEMETRY_OPTOUT: 1 DOTNET_NOLOGO: true diff --git a/src/Scrutor/Scrutor.csproj b/src/Scrutor/Scrutor.csproj index 7318546c..9762aae8 100644 --- a/src/Scrutor/Scrutor.csproj +++ b/src/Scrutor/Scrutor.csproj @@ -25,6 +25,9 @@ snupkg 6.0.0.0 + + true + true