Skip to content

chore: migrate test project from xunit v2 to xunit.v3#122

Merged
kellylford merged 2 commits into
mainfrom
chore/xunit-v3-migration
Jun 22, 2026
Merged

chore: migrate test project from xunit v2 to xunit.v3#122
kellylford merged 2 commits into
mainfrom
chore/xunit-v3-migration

Conversation

@kellylford

Copy link
Copy Markdown
Owner

Summary

  • Replaces xunit 2.9.3 with xunit.v3 3.2.2
  • Bumps Xunit.StaFact from 1.1.11 to 3.0.13
  • No test code changes needed — all attributes and assertions are source-compatible between v2 and v3

Why

Xunit.StaFact 2.x+ targets xunit v3. Running both xunit (v2) and the v3 core pulled in by StaFact in the same project causes CS0433 type-ambiguity errors on [Fact], [Collection], and related attributes. This failure first appeared on Dependabot PR #84 after yesterday's merges added new test files.

Rather than pin StaFact to the last xunit-v2-compatible release (1.2.69), this migrates the full test project to xunit.v3, which is the current/maintained path.

Test plan

  • All existing tests pass on CI (.NET 8, Windows runner)
  • No CS0433 ambiguity errors
  • [StaFact] and [StaTheory] STA-thread WPF tests run correctly

Closes Dependabot PR #84.

Generated with Claude Code

kellylford and others added 2 commits June 22, 2026 08:05
Replace xunit 2.9.3 with xunit.v3 3.2.2 and bump Xunit.StaFact from
1.1.11 to 3.0.13. StaFact 2.x+ targets xunit v3; running both v2 and
v3 in the same project causes CS0433 type-ambiguity errors on [Fact],
[Collection], and related attributes.

No test code changes needed — [StaFact], [StaTheory], [Fact], [Theory],
[InlineData], [Collection], [CollectionDefinition], and all Assert.*
calls are source-compatible between v2 and v3.

Resolves the build failure on Dependabot PR #84.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
xunit.v3 (via xunit.v3.core.mtp-v1) injects a buildTransitive props file
that sets UseAppHost=true. Combined with the existing RuntimeIdentifier=win-x64,
the .NET 8 SDK treats the test project as a non-self-contained executable
referencing a self-contained project (QuickMail.csproj), which triggers
NETSDK1151. Explicitly setting SelfContained=true matches the main project
and satisfies the SDK constraint.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@kellylford
kellylford merged commit 8576bdc into main Jun 22, 2026
3 checks passed
@kellylford
kellylford deleted the chore/xunit-v3-migration branch June 22, 2026 16:50
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.

1 participant