The Wayback Machine - https://web.archive.org/web/20241119053219/https://github.com/dotnet/roslyn/issues/73743
Skip to content

Compiler chooses params span overload in expression trees leading to errors #73743

Open

Description

Version Used:
4.11.0-2.24268.2+b9c35f1021d2d9d40521474c388d49ee7580ec98

Steps to Reproduce:

  1. Call an API that has both params [] and params span overloads from an expression.

Minimal repro: exprSpan.zip

(sharplab doesn't yet have params span feature)

This could be seen as a source-breaking change for folks if they hit in conjunction with seeing new params span overloads for framework APIs. That's what happened here dotnet/efcore@dae7d42

Diagnostic Id:
CS8640, CS9226

Expected Behavior:
No error

Actual Behavior:

C:\scratch\exprSpan\Program.cs(8,51): error CS8640: Expression tree cannot contain value of ref struct or restricted type 'ReadOnlySpan'.
C:\scratch\exprSpan\Program.cs(8,51): error CS9226: An expression tree may not contain an expanded form of non-array params collection parameter.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions