Skip to content

Conversation

@khellang
Copy link
Owner

@khellang khellang commented Nov 24, 2025

Closes #254

- 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
- 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
- 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.
- 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.
- 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.
- 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.
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'.
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.
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.
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.
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.
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.
Copilot AI review requested due to automatic review settings November 24, 2025 18:39
Copilot finished reviewing on behalf of khellang November 24, 2025 18:41
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR upgrades the Scrutor project from .NET 9 to .NET 10, including modernization of the test infrastructure by migrating from xUnit v2 to xUnit v3 with the Microsoft Testing Platform.

Key Changes:

  • Upgrade to .NET 10 SDK and target frameworks across all projects
  • Migrate test project from xUnit v2 to xUnit v3 with Microsoft Testing Platform
  • Update build workflow to use new coverage collection approach with dotnet-coverage tool

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated no comments.

Show a summary per file
File Description
global.json Specifies .NET 10 SDK version and Microsoft Testing Platform as the test runner
NuGet.Config Updates package source from dotnet8 to dotnet10 feed
src/Scrutor/Scrutor.csproj Adds net10.0 target framework and updates Microsoft.Extensions packages to 10.0.0
test/Scrutor.Tests/Scrutor.Tests.csproj Updates to net10.0, migrates to xUnit v3 with Microsoft Testing Platform, and updates dependencies
.github/workflows/build.yml Updates to .NET 10 SDK, replaces test coverage collection with dotnet-coverage tool, and upgrades codecov action to v5

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Package flagged as non-deterministic

3 participants