Skip to content

Interpolated string in expression tree lambda doesn't compile #55114

@AndriySvyryd

Description

@AndriySvyryd

The following works in .NET 5:

Func<IQueryable<string>, IQueryable<string>> f = s => s.Select(o => $"{o.Length}")

But in 6.0.100-preview.7.21373.8 it errors out:

error CS8640: Expression tree cannot contain value of ref struct or restricted type 'DefaultInterpolatedStringHandler'.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Area-CompilersuntriagedIssues and PRs which have not yet been triaged by a lead

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions