Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CA1845 fix causes a CS8640 error when used in an expression tree #7428

Open
Okinodwa opened this issue Oct 2, 2024 · 0 comments
Open

CA1845 fix causes a CS8640 error when used in an expression tree #7428

Okinodwa opened this issue Oct 2, 2024 · 0 comments

Comments

@Okinodwa
Copy link

Okinodwa commented Oct 2, 2024

Analyzer

Diagnostic ID: CA1845: Use span-based 'string.Concat'

Describe the bug

When concatenating substring calls, CA1845 is triggered. However, when it is triggered inside of an expression tree, the fix for CA1845 (using String.Concat() with .AsSpan()) results in the error: CS8640: Expression tree cannot contain value of ref struct or restricted type.

Expected behavior

I would expect the CA1845 to not trigger in the context of an expression tree.

Actual behavior

The rule is triggered, and results in a complier error when fix is applied.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant