Hacktoberfest 2026: le issue che i maintainer hanno segnato per ottobre, aperte e adatte ai principianti. Sfoglia le issue Hacktoberfest

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

Chiusa
#7,151 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Una pull request collegata è già stata integrata.

  • #7200 di @thomhurst — integrata

Valutazione

Difficoltà
4/5
Tempo stimato
3-5 giorni
Idoneità per principianti
35/100
Tipo di issue
Bug
Chiarezza
Abbastanza chiara
Stato di attività
Ferma
Stack tecnologico
csharp
Ambito
testing-qa

Direzione di ricerca

Start with the TRX className values in the issue and compare how source-generated and reflection modes produce them. Read src/TUnit.Engine/Extensions/TestExtensions.cs and the #6433 type-name format decision; the issue also points to tests/TUnit.TestProject/Bugs/_7106. Reproduce with the supplied commands and compare the two TRX files; done means both modes produce the same class name for generic tests.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

bug

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.

Lingua principale
C#
Stelle
4k
Fork
139
Merge medio
7h 44m
PR unite (30g)
271

Preparare l'ambiente

Apri in Codespaces

Avvia il container di sviluppo del progetto nel browser, con il tuo account GitHub.

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di thomhurst/TUnit

Tutte le issue di thomhurst/TUnit

Issue simili

Altre issue su C#

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.