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
Source-gen: generic method runs only the first [Arguments] row per inferred type #7096
In source-generated mode, a generic test method with several [Arguments] rows only runs the first row for each inferred type argument. Any later row that infers the same T is silently dropped. Reflection mode runs every row.
publicclassGenericMethodSameTypeArgumentsTests{[Test][Arguments(1)][Arguments(2)][Arguments(3)]publicasyncTaskSameType<T>(Tvalue){awaitAssert.That(value).IsTypeOf<int>();}[Test][Arguments(1)][Arguments("a")][Arguments(2)][Arguments("b")]publicasyncTaskMixedTypes<T>(Tvalue){awaitAssert.That(valueisint or string).IsTrue();}}
Run with --treenode-filter "/*/<namespace>/GenericMethodSameTypeArgumentsTests/*".
Expected
7 tests in both modes: SameType runs for 1, 2 and 3, and MixedTypes runs for 1, "a", 2 and "b".
Nothing fails or warns. The extra rows just never get discovered.
Root cause
TestMetadataGenerator.CollectConcreteInstantiations builds one concrete instantiation per type-argument combination and skips any combination it has already seen (processedTypeCombinations, keyed by BuildTypeKey). For [Arguments] rows, the instantiation also records the row that produced it (SpecificArgumentsAttribute), and EmitConcreteDataSources / EmitConcreteAttributeFactory then emit only that row as the entry's data source. So the second [Arguments(2)] row infers int, hits the dedup, and is discarded, and the int entry only carries [Arguments(1)].
Related observations (not part of this fix)
Generic classes have similar gaps, but there reflection mode doesn't run every row either, so the two modes already agree:
[Arguments(1)] [Arguments(2)] class Foo<T>(T value) runs 1 test in both modes.
class Foo<T> { [Test, Arguments(1), Arguments(2)] void M(T value) } runs 1 test in source-gen and 0 in reflection.
Activity
test: fix #7096 engine filters for AOT and restore missing snapshot row
test: accept Tests7096 snapshot with methodTypeArgumentsIdentity
fix(sourcegen): run every [Arguments] row that infers the same generi…
fix(engine): align reflection-mode data sources and hooks with source…