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
NET-3878 Fix S3358 FP: Suggesting to extract ternary from EF Core select #9801
changed the title [-]Fix S3358 FP: Suggesting to extract ternary from EF Core select[/-][+]NET-3878 Fix S3358 FP: Suggesting to extract ternary from EF Core select[/+]on Jun 5, 2026
Hi @grosch-intl, thanks for the report — confirmed as a false positive. Inside an IQueryable<T>.Select(...) lambda, the C# compiler converts the body to an Expression<Func<T, TResult>>, where statement-bodied lambdas aren't legal (CS0834) — so the rule's "extract into an independent statement" advice can't be followed.
Tracked internally as NET-3878 and a fix is up for review. It will roll out with the next analyzer release.
martin-strecker-sonarsource commented on Jun 17, 2026
Activity
[-]Fix S3358 FP: Suggesting to extract ternary from EF Core select[/-][+]NET-3878 Fix S3358 FP: Suggesting to extract ternary from EF Core select[/+]github-actions commentedon Jun 5, 2026
Internal ticket NET-3878
martin-strecker-sonarsource commentedon Jun 5, 2026
Hi @grosch-intl, thanks for the report — confirmed as a false positive. Inside an
IQueryable<T>.Select(...)lambda, the C# compiler converts the body to anExpression<Func<T, TResult>>, where statement-bodied lambdas aren't legal (CS0834) — so the rule's "extract into an independent statement" advice can't be followed.Tracked internally as NET-3878 and a fix is up for review. It will roll out with the next analyzer release.
martin-strecker-sonarsource commentedon Jun 17, 2026
The issue was fixed in 7596b50 and will be part of the next release. Thank you @grosch-intl for the report!