Skip to content

TRX className for generic test classes differs between source-generated and reflection modes #7151

Closed

Description

@thomhurst

What I saw

While running tests/TUnit.TestProject (net10.0, Release) with --treenode-filter "/*/TUnit.TestProject.Bugs._7106/*/*" --report-trx in each mode, the TRX className for tests on generic classes is different:

  • Source-generated mode: TUnit.TestProject.Bugs._7106.GenericClassSameTypeRows1`
  • Reflection mode (--reflection): TUnit.TestProject.Bugs._7106.GenericClassSameTypeRows1[[System.Int32, System.Private.CoreLib, Version=10.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]]`

Every generic class in Bugs/_7106 shows the same split. In reflection mode, rows that infer different type arguments are also split across several class names (GenericClassMixedTypeRows1[[System.Int32...]]and...[[System.String...]]`), while source-generated mode groups them under one name.

Found while working on #7123 (PR #7150). The difference is not related to that change.

Repro

cd tests/TUnit.TestProject
dotnet build -c Release -f net10.0
bin/Release/net10.0/TUnit.TestProject.exe --treenode-filter "/*/TUnit.TestProject.Bugs._7106/*/*" --report-trx --report-trx-filename sg.trx
bin/Release/net10.0/TUnit.TestProject.exe --treenode-filter "/*/TUnit.TestProject.Bugs._7106/*/*" --reflection --report-trx --report-trx-filename refl.trx

Compare the className= attributes in the two files.

Expected

The same class name in both modes, so that TRX consumers and CI test-history grouping see the same identity whichever mode runs. The likely source is the type name that reaches the TRX reporter (TestMethodIdentifierProperty in src/TUnit.Engine/Extensions/TestExtensions.cs, or the closed Type that reflection mode reports). This needs checking against the #6433 decision on the type-name format.

Activity

  1. added a commit that references this issue on Oct 20, 2026
    9214a41
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