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
Support typed rows for C# 13 params ReadOnlySpan<T> parameters #7462
Typed test-data rows do not support packing individual elements into C# 13 params ReadOnlySpan<T> parameters. Packing currently supports arrays and five array-assignable collection interfaces. Support for span params would let users pass typed rows to methods using the newer C# syntax.
Reproduction
On .NET 10, declare a TypedDataSourceAttribute<(int[], string)> source and apply it to [Test] void Run<T>(T[] values, params ReadOnlySpan<string> rest). The row contains an array and one string; the desired invocation packs the string into rest.
Proposal
Support span params consistently in source-generated discovery, reflection execution and analyzer validation, or provide a specific unsupported-parameter diagnostic. Reflection invocation cannot box a span, so accepting the analyzer conversion alone is insufficient.
At main commit d9e9e66, TupleArgumentHelper.GetTrailingElementType and ReflectionTestDataCollector.GetTrailingElementType only accept arrays and IEnumerable<T>, ICollection<T>, IList<T>, IReadOnlyCollection<T>, and IReadOnlyList<T>. Both return null for ReadOnlySpan<T>.
Discovered while reviewing #7460; broader params support is outside its array-inference scope. Please handle the span parameter consistently in both execution modes.
Triage checked against origin/main at d9e9e66: both TupleArgumentHelper.GetTrailingElementType and ReflectionTestDataCollector.GetTrailingElementType still exclude ReadOnlySpan. Open PR #7460 addresses array inference, not span invocation, and does not supersede this issue. No duplicate, stale claim, or prerequisite was found; the issue remains current and available for implementation.
Activity
thomhurst commentedon Nov 3, 2026
Triage checked against origin/main at d9e9e66: both TupleArgumentHelper.GetTrailingElementType and ReflectionTestDataCollector.GetTrailingElementType still exclude ReadOnlySpan. Open PR #7460 addresses array inference, not span invocation, and does not supersede this issue. No duplicate, stale claim, or prerequisite was found; the issue remains current and available for implementation.
Address span params analyzer review feedback (#7462)
Diagnose unsupported span params on test methods (#7679)