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 instantiations from empty or private own-class member sources differ between source-generated and reflection mode #7903
Six generic test classes still run different numbers of tests in source-generated and reflection mode. None of them fails in either mode: the difference is an extra skipped test, or an extra passing instantiation that only one mode builds. Both cases come from how an instantiation falls back when its own-class member source is empty or not usable.
Reproduction
The fixtures are in tests/TUnit.TestProject/Bugs/_7543/SourceProviderPartitionTests.cs. GenericClassSourceInferenceParityTests.Remaining_Partition_Differences_Are_Pinned pins the current counts per mode. Run each class with --treenode-filter "/*/TUnit.TestProject.Bugs._7543/<Class>/*", then again with --reflection:
Class
Source-generated
Reflection
DirectEmptyDeclaredRowPartition
1 passed, 1 skipped
1 passed
InheritedEmptyDeclaredRowPartition
1 passed, 1 skipped
1 passed
ExplicitEmptyDeclaredRowPartition
1 passed, 1 skipped
2 passed, 1 skipped
ExplicitEmptyConstructorLiteralMethodRows
1 passed
2 passed, 1 skipped
ExplicitEmptyConstructorProviderMethodRows
1 passed
2 passed, 1 skipped
InheritedPrivateRowSource
1 passed
2 passed
Expected and actual
Empty SkipIfEmpty own-class member (IEnumerable<string> Rows() => [] beside [Arguments(42)]): source-generated mode closes C<string> from the member's declared rows and shows it as a skipped test. Reflection mode groups class rows by the rows it reads, so an empty member creates no instantiation. One rule should decide whether an empty declared source yields a skipped test.
Explicit [GenerateGenericTest(typeof(IComparable))] instantiation, whose own-class member is empty or a private member of a base class: reflection mode builds it from an assignable literal class row ([Arguments(42)] for IComparable), or reads the private member on the closed class. Source-generated mode emits no test for it.
Expected: both modes run the same tests for each class. Please pick one fallback rule for empty declared sources and for explicit instantiations without a matching class row, and apply it in both modes.
Environment
main after the generic class-source inference PR, .NET SDK 10.0.403, net10.0, macOS arm64. Follow-up to #7543.
Activity
fix(generic): infer generic class types from member, typed and type-f…