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
Reflection fails to bind preserved tuples after closing a generic test method #7482
A generic test accepting (T, object) passes with a method data source returning (int, string) in source-generated mode but fails during invocation in reflection mode. Reflection infers the type argument correctly but passes the original incompatible value tuple to the closed method.
Both modes should bind the tuple after inferring T = int. Generated mode passes. Reflection throws ArgumentException: System.ValueTuple<int, string> cannot be converted to System.ValueTuple<int, object>.
The tuple is preserved before inference, but the reflection invoker never reconstructs it after the method closes. The invoker on current main passes the preserved tuple through its ordinary argument-casting path. The flattened-row reconstruction added by the still-open #7469 also does not handle this one-argument preserved tuple.
Environment
.NET SDK 10.0.403, net10.0, macOS arm64. Reproduced at merge base 67870ed and on e1d8214; this predates #7469. Generated mode passes on the PR head.
Remaining work and acceptance criteria
Normalize preserved tuple rows against the closed method parameter types after generic inference, preserving already compatible tuples.
Run the reproduction in source-generated and reflection modes, asserting T = int and both tuple element values.
Triaged against origin/main at 1f70564. DataUnwrapper.UnwrapWithTypesInternal preserves a single tuple parameter; ReflectionTestDataCollector.CreateReflectionTestInvoker closes the method, then uses ordinary argument casting before Invoke. The preserved tuple therefore still needs normalization to the closed tuple type. Clarified acceptance criteria and its role as #7481's binding prerequisite. #7469 remains open and does not deliver this generic binding fix.
Activity
thomhurst commentedon Nov 3, 2026
Triaged against origin/main at 1f70564.
DataUnwrapper.UnwrapWithTypesInternalpreserves a single tuple parameter;ReflectionTestDataCollector.CreateReflectionTestInvokercloses the method, then uses ordinary argument casting beforeInvoke. The preserved tuple therefore still needs normalization to the closed tuple type. Clarified acceptance criteria and its role as #7481's binding prerequisite. #7469 remains open and does not deliver this generic binding fix.Fix legacy long-tuple unwrapping for #7482
Fix preserved generic tuple binding in reflection mode (#7487)