You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Generic class with a class [Arguments] row that infers no type argument: modes disagree on T and constructor values, source-gen drops [Arguments(null)] #7209
A generic test class has a class-level [Arguments] row whose values go to constructor parameters that are not type parameters. Source-generated mode and reflection mode then choose different instantiations and constructor arguments, and source-generated mode drops an [Arguments(null)] method row.
Observed on the fix/issue-7141-null-row-generic-class branch (PR #7203, based on main at c4b9977), net10.0, filter /*/TUnit.TestProject.Bugs._7141/Probe*/*:
Mode
Tests
Values
Source-generated
1: Run(1)
T=Int32 number=1. The class is built from the method row's value (#7161), and the null row produces no test.
Reflection (--reflection)
2: Run(null), Run(1)
T=Int32 number=42 for both. T is inferred from the class row value 42, although the constructor parameter is int, not T.
Expected
Both modes should agree, and no row should vanish. A class row whose values map to no type parameter supplies no class type argument. In that case T should come from the method rows, as it does without a class row: C<int> for [Arguments(1)] and C<object> for [Arguments(null)] (#7141). The instance should be constructed from the class row (number=42).
Reflection: class-row grouping infers T from a class row value that is not passed to a T parameter.
This came up in review of PR #7203 (#7203 (comment)). It should be fixed after #7149 and #7192 merge, because they rework the class-row and method-row pairing and instance construction for exactly this shape.
Activity