From 58af30e316c3f5dccbffbae1477857778cd24756 Mon Sep 17 00:00:00 2001 From: Philippe Matray Date: Mon, 9 Mar 2026 11:08:07 +0100 Subject: [PATCH 1/2] fix: add CancellationToken parameter to Command Execute methods Spectre.Console.Cli v0.53.1 changed the Command base class to require a CancellationToken parameter in the Execute method signature. Update all four command classes to match the new abstract method. --- AutoTestId/Commands/FileCommand.cs | 2 +- AutoTestId/Commands/FolderCommand.cs | 2 +- AutoTestId/Commands/ProjectCommand.cs | 2 +- AutoTestId/Commands/SolutionCommand.cs | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/AutoTestId/Commands/FileCommand.cs b/AutoTestId/Commands/FileCommand.cs index 38ba3ab..5f324fb 100644 --- a/AutoTestId/Commands/FileCommand.cs +++ b/AutoTestId/Commands/FileCommand.cs @@ -20,7 +20,7 @@ public class FileCommand : Command /// The command context /// The command settings /// Exit code (0 for success, non-zero for failure) - public override int Execute([NotNull] CommandContext context, [NotNull] FileCommandSettings settings) + public override int Execute([NotNull] CommandContext context, [NotNull] FileCommandSettings settings, CancellationToken cancellationToken) { try { diff --git a/AutoTestId/Commands/FolderCommand.cs b/AutoTestId/Commands/FolderCommand.cs index 4219846..a53be4e 100644 --- a/AutoTestId/Commands/FolderCommand.cs +++ b/AutoTestId/Commands/FolderCommand.cs @@ -20,7 +20,7 @@ public class FolderCommand : Command /// The command context /// The command settings /// Exit code (0 for success, non-zero for failure) - public override int Execute([NotNull] CommandContext context, [NotNull] FolderCommandSettings settings) + public override int Execute([NotNull] CommandContext context, [NotNull] FolderCommandSettings settings, CancellationToken cancellationToken) { try { diff --git a/AutoTestId/Commands/ProjectCommand.cs b/AutoTestId/Commands/ProjectCommand.cs index aa0a859..598416c 100644 --- a/AutoTestId/Commands/ProjectCommand.cs +++ b/AutoTestId/Commands/ProjectCommand.cs @@ -21,7 +21,7 @@ public class ProjectCommand : Command /// The command context /// The command settings /// Exit code (0 for success, non-zero for failure) - public override int Execute([NotNull] CommandContext context, [NotNull] ProjectCommandSettings settings) + public override int Execute([NotNull] CommandContext context, [NotNull] ProjectCommandSettings settings, CancellationToken cancellationToken) { try { diff --git a/AutoTestId/Commands/SolutionCommand.cs b/AutoTestId/Commands/SolutionCommand.cs index 98767c8..1d0e851 100644 --- a/AutoTestId/Commands/SolutionCommand.cs +++ b/AutoTestId/Commands/SolutionCommand.cs @@ -21,7 +21,7 @@ public class SolutionCommand : Command /// The command context /// The command settings /// Exit code (0 for success, non-zero for failure) - public override int Execute([NotNull] CommandContext context, [NotNull] SolutionCommandSettings settings) + public override int Execute([NotNull] CommandContext context, [NotNull] SolutionCommandSettings settings, CancellationToken cancellationToken) { try { From 6eb0389a772bbda1d4483fcc1073e796670baf3e Mon Sep 17 00:00:00 2001 From: Philippe Matray Date: Mon, 9 Mar 2026 11:14:29 +0100 Subject: [PATCH 2/2] Fix coverage job by switching from dotnet run to dotnet test with coverlet The coverage job was using `dotnet run -- --coverage` flags which are not recognized by the xUnit v3 Microsoft Testing Platform runner. Switch to `dotnet test --collect:"XPlat Code Coverage"` with coverlet.collector package, which is the standard approach for collecting code coverage with xUnit v3. --- .github/workflows/dotnet.yml | 11 ++++++----- AutoTestId.UnitTests/AutoTestId.UnitTests.csproj | 1 + 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/.github/workflows/dotnet.yml b/.github/workflows/dotnet.yml index 9941171..007e63a 100644 --- a/.github/workflows/dotnet.yml +++ b/.github/workflows/dotnet.yml @@ -57,14 +57,15 @@ jobs: run: dotnet build --no-restore --configuration Release - name: Test with coverage - run: | - cd AutoTestId.UnitTests - dotnet run --configuration Release -- --coverage --coverage-output-format cobertura --coverage-output coverage.cobertura.xml - + run: > + dotnet test --no-build --configuration Release + --collect:"XPlat Code Coverage" + --results-directory ./coverage + - name: Upload coverage to Codecov uses: codecov/codecov-action@v5 with: - file: ./AutoTestId.UnitTests/coverage.cobertura.xml + directory: ./coverage fail_ci_if_error: false verbose: true diff --git a/AutoTestId.UnitTests/AutoTestId.UnitTests.csproj b/AutoTestId.UnitTests/AutoTestId.UnitTests.csproj index 2fda140..97f609b 100644 --- a/AutoTestId.UnitTests/AutoTestId.UnitTests.csproj +++ b/AutoTestId.UnitTests/AutoTestId.UnitTests.csproj @@ -23,6 +23,7 @@ +