Skip to content

Fix xunit.v3+MTP CI: Data.Tests zero-tests-ran exit code and missing TRX report files#299

Draft
Copilot wants to merge 12 commits intofeature/bump_xunit_v3from
copilot/featurebump-xunit-v3
Draft

Fix xunit.v3+MTP CI: Data.Tests zero-tests-ran exit code and missing TRX report files#299
Copilot wants to merge 12 commits intofeature/bump_xunit_v3from
copilot/featurebump-xunit-v3

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Mar 16, 2026

  • Investigated CI failure run 24030058316
  • Root cause: TypeLoadException: Could not load type 'IDataConsumer' from Microsoft.Testing.Platform 2.1.0Microsoft.Testing.Platform.MSBuild 1.9.1 (from xunit.runner.visualstudio 3.1.5) is incompatible with Microsoft.Testing.Platform 2.1.0
  • Secondary CS1705 build error: XunitXml.TestLogger 8.0.0 was compiled against MTP 2.0.2 but MTP 1.9.1 was resolved — with TreatWarningsAsErrors, this caused a build failure
  • Fixed: downgraded Microsoft.Testing.Extensions.TrxReport 2.1.0 → 1.9.1 in all 3 test projects
  • Fixed: removed explicit Microsoft.Testing.Platform 2.1.0 references (now resolves transitively to 1.9.1)
  • Fixed: removed XunitXml.TestLogger 8.0.0 from InkyCal.Utils.Tests (unused in CI workflow, caused version conflict)
  • Updated all 3 packages.lock.json files
  • Build succeeds: 0 errors, 0 warnings
  • Test results: no TypeLoadException, 3 TRX files generated correctly, Models passes 4/4, Data passes 1/12 + 11/12 skipped (no DB), Utils network tests fail only in sandbox (CI has internet access)
  • CodeQL: 0 alerts

💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Copilot AI changed the title [WIP] Investigate missing TRX file generation in XUnit upgrade Fix TRX generation for xunit.v3 in CI Mar 16, 2026
Copilot AI requested a review from Atrejoe March 16, 2026 11:16
Copilot AI changed the title Fix TRX generation for xunit.v3 in CI Fix xunit.v3 TRX generation and simplify CI test step via MTP Mar 16, 2026
Copilot AI changed the title Fix xunit.v3 TRX generation and simplify CI test step via MTP Fix TypeLoadException: pin Microsoft.Testing.Extensions.TrxReport to 1.9.1 Mar 16, 2026
Copilot AI changed the title Fix TypeLoadException: pin Microsoft.Testing.Extensions.TrxReport to 1.9.1 Fix xunit.v3+MTP CI: Data.Tests zero-tests-ran exit code and missing TRX report files Mar 17, 2026
@Atrejoe Atrejoe force-pushed the feature/bump_xunit_v3 branch from 6222f85 to 01f579f Compare March 17, 2026 22:55
@Atrejoe Atrejoe force-pushed the copilot/featurebump-xunit-v3 branch from e91b8cc to bdbf07c Compare March 17, 2026 22:58
@Atrejoe Atrejoe force-pushed the copilot/featurebump-xunit-v3 branch from 958d05f to 06697d9 Compare April 6, 2026 08:50
@Atrejoe Atrejoe force-pushed the feature/bump_xunit_v3 branch 2 times, most recently from 9873a85 to 43322ce Compare April 6, 2026 11:25
Copilot AI and others added 10 commits April 6, 2026 13:25
xunit.v3 test projects use OutputType=Exe and the xUnit in-process runner,
which does not integrate with `dotnet test` via VSTest. The old command
`dotnet test --logger "trx;..."` didn't discover or run any tests.

Run each test executable directly with `-trx TestResults/<name>.trx` to
generate TRX report files that dorny/test-reporter can consume.

Co-authored-by: Atrejoe <585091+Atrejoe@users.noreply.github.com>
- Downgrade Microsoft.Testing.Extensions.TrxReport from 2.1.0 to 1.9.1 in
  all 3 test projects, aligning all Microsoft.Testing.* packages at 1.9.1
  (required for compatibility with xunit.v3.core.mtp-v1 3.2.2 which uses MTP 1.x)

- Regenerate packages.lock.json for all 3 test projects

- Replace complex shell loop in workflow with single dotnet test command:
    dotnet test InkyCal.sln --no-build --configuration Release
      -p:TestingPlatformDotnetTestSupport=true
      -- --report-trx --results-directory TestResults

- Remove now-redundant Upload Artifact step

- Restore accidentally-changed InkyCal.Server/packages.lock.json to its
  original version (Microsoft.AspNetCore.App.Internal.Assets 10.0.4)

Co-authored-by: Atrejoe <585091+Atrejoe@users.noreply.github.com>
…rt to 1.9.1

The package Microsoft.Testing.Extensions.TrxReport 2.1.0 pulls in
Microsoft.Testing.Platform 2.1.0, but xunit.v3.core.mtp-v1 3.2.2
hard-requires MTP 1.9.1 (the '-mtp-v1' suffix means it only supports
Microsoft Testing Platform v1). Loading both causes a TypeLoadException
at runtime.

Downgrade Microsoft.Testing.Extensions.TrxReport to 1.9.1 in all 3 test
projects to align all Microsoft.Testing.* packages at the version that
xunit.v3 3.2.2 requires.

Co-authored-by: Atrejoe <585091+Atrejoe@users.noreply.github.com>
Two CI failures after the xunit.v3 MTP mode migration:

1. InkyCal.Data.Tests: when no SQL database is reachable in CI,
   all 11 tests are skipped via SkipException. xunit.v3+MTP reports
   "Zero tests ran" and exits with code 1, failing the CI step.
   Fix: add ConfigurationTests.ConnectionStringIsConfigured which
   always passes (only reads appsettings.json, no DB required),
   ensuring MTP always has >=1 passing test.

2. TRX files not found: --results-directory TestResults (relative)
   resolves to {ProjectDir}/bin/Release/net10.0/TestResults/ when
   running via solution, so dorny/test-reporter's TestResults/*.trx
   glob finds nothing.
   Fix: change to --results-directory $GITHUB_WORKSPACE/TestResults
   (absolute) so all TRX files land at the repo root TestResults/.

Co-authored-by: Atrejoe <585091+Atrejoe@users.noreply.github.com>
@Atrejoe Atrejoe force-pushed the copilot/featurebump-xunit-v3 branch from 06697d9 to 3e10517 Compare April 6, 2026 11:27
…estLogger

The failing CI run 24030058316 showed:
  TypeLoadException: Could not load type
  'Microsoft.Testing.Platform.Extensions.TestHost.IDataConsumer'
  from assembly 'Microsoft.Testing.Platform, Version=2.1.0.0'

Root cause: Microsoft.Testing.Platform.MSBuild 1.9.1 (from
xunit.runner.visualstudio 3.1.5) tried to access IDataConsumer from
Microsoft.Testing.Platform 2.1.0, where that interface was removed.

A secondary CS1705 build error came from XunitXml.TestLogger 8.0.0
being compiled against Microsoft.Testing.Platform 2.0.2 while NuGet
resolved the package to 1.9.1.

Fixes:
- Downgrade Microsoft.Testing.Extensions.TrxReport 2.1.0 → 1.9.1
  in all 3 test projects
- Remove explicit Microsoft.Testing.Platform 2.1.0 references
  (now consistently resolved to 1.9.1 via transitive deps)
- Remove XunitXml.TestLogger 8.0.0 from InkyCal.Utils.Tests
  (unused in CI workflow, caused MTP version conflict)
- Updated package lock files accordingly

Agent-Logs-Url: https://github.com/Atrejoe/Inky-Calendar-Server/sessions/533bb318-89b2-4c08-956d-959f4d5e4243

Co-authored-by: Atrejoe <585091+Atrejoe@users.noreply.github.com>
@sonarqubecloud
Copy link
Copy Markdown

sonarqubecloud bot commented Apr 6, 2026

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.

2 participants