Skip to content

[Chore] Tests are still on xunit v2, which is deprecated and hasn't had a release since January 2025 #4528

Open

Description

@gitmln

Is your feature request related to a problem? Please describe.

All the test projects use xunit 2.9.3. That came out in January 2025 and the release notes already said it should be the last v2 release. The package is deprecated on NuGet, with a note that it'll only get security fixes and all new work is on v3.

There's also a practical problem with it. Xunit v2 doesn't support IAsyncDisposable on test classes (v3 does, see the docs), so DisposeAsync just never gets called. I found 24 test classes on master that only implement IAsyncDisposable, so their cleanup never runs. For example SqsSchedulingAsyncMessageTest is supposed to delete its SQS queue there. Same root cause as the S3 buckets in bugfixes/0032-s3-test-bucket-cleanup.

Describe the solution you'd like

Move to xunit.v3. CI doesn't need to change for that, if you keep xunit.runner.visualstudio and set IsTestingPlatformApplication=false the projects still run with dotnet test on VSTest. MTP could come later. xunit.v3 3.1.0 is already in Directory.Packages.props, just not used anywhere.

Things to watch out for: test projects need OutputType=Exe, IAsyncLifetime uses ValueTask in v3 (so the test generator templates need updating too), and when a class implements both IDisposable and IAsyncDisposable v3 only calls DisposeAsync. There are 183 of those, so anything that only happens in Dispose would need moving.

There's an agent skill for this migration that covers the VSTest setup as well: migrate-xunit-to-xunit-v3. Could be useful with the /spec workflow.

Describe alternatives you've considered

TUnit, like in #4065. But Fences is already going to xunit v3 / MTP (BrighterCommand/Fences#34, porting it from Polly), so xunit would keep both repos on the same framework. There was also #3844, which got folded into #3971 and then closed without being merged.

Additional context

xunit's migration guide: https://xunit.net/docs/getting-started/v3/migration


Prepared with help of an AI assistant.

Activity

  1. added
    dependenciesPull requests that update a dependency file
    .NETPull requests that update .net code
    MaintenanceBuild, CI, refactoring, testing infrastructure, and other chores
    on Oct 5, 2026
  2. iancooper commented on Oct 5, 2026

    @iancooper
    Member

    Good call

  3. changed the title [-]Tests are still on xunit v2, which is deprecated and hasn't had a release since January 2025[/-] [+][Chore] Tests are still on xunit v2, which is deprecated and hasn't had a release since January 2025[/+] on Oct 15, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    .NETPull requests that update .net code0 - BacklogMaintenanceBuild, CI, refactoring, testing infrastructure, and other choresdependenciesPull requests that update a dependency file

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions