Skip to content

TUXU0001: XUnitMigrationCodeFixProvider Fix All action not working #4416

Description

@thomhurst

Description

When running the xUnit to TUnit migration code fixer using dotnet format analyzers, the Fix All action fails with the message:

Unable to fix TUXU0001. Code fix XUnitMigrationCodeFixProvider didn't return a Fix All action.

This prevents automated batch migration of test files.

Steps to Reproduce

  1. Create a test project with xUnit tests
  2. Add TUnit package (version 1.11.*)
  3. Add the following to the csproj:
<TUnitImplicitUsings>false</TUnitImplicitUsings>
<TUnitAssertionsImplicitUsings>false</TUnitAssertionsImplicitUsings>
  1. Run: dotnet format analyzers --severity info --diagnostics TUXU0001

Expected Behavior

The code fixer should convert all xUnit tests to TUnit format in batch mode.

Actual Behavior

The fixer reports "Unable to fix TUXU0001. Code fix XUnitMigrationCodeFixProvider didn't return a Fix All action" and only partially converts files.

In my test case with ~85 test files:

  • Only ~54 files (~63%) were converted to use [Test] attribute
  • ~31 files (~37%) were not converted at all and still have [Fact] attribute

Environment

  • TUnit Version: 1.11.*
  • .NET SDK: 10.0.102
  • OS: Windows

Additional Context

The migration documentation at https://tunit.dev/docs/migration/xunit recommends using dotnet format analyzers for batch migration, but this approach doesn't work due to the Fix All action not being implemented.

Suggested Fix

The XUnitMigrationCodeFixProvider needs to implement the GetFixAllProvider() method to return a proper FixAllProvider that can handle batch operations.

Tests Needed

Please add tests to verify:

  1. Fix All in Document scope works
  2. Fix All in Project scope works
  3. Fix All in Solution scope works

Activity

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

    bugSomething isn't working

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions