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
string[] values = new[] { "one", "two", "three", "four" };
return AssertQuery(
async,
ss => from e in ss.Set<PrimitiveCollectionsEntity>()
let value = e.Id > 0 && e.Id < 4 ? values[e.Id] : "zero"
select new { e.Id, value });
when ran in the "legacy" mode, we throw
Unable to cast object of type 'System.String[]' to type 'System.Linq.IQueryable`1[System.String]'.
exec sp_executesql N'SELECT [p].[Id], CASE WHEN [p].[Id] > 0 AND [p].[Id] < 4 THEN CAST(1 AS bit) ELSE CAST(0 AS bit)END, @__values_0FROM [PrimitiveCollectionsEntity] AS [p]',N'@__values_0 nvarchar(4000)',@__values_0=N'["one","two","three","four"]'
values parameter is array of strings, and we do read it as IEnumerable initially, but the ElementAt method that we use to get the element we need is on IQueryable, so we try convert to IQueryable and ultimately fail.
In preprocessing we normalize indexer over parameter array into: [ParameterQueryRootExpression].AsQueryable().ElementAt(...), then nav expansion gobbles up AsQueryable call (because in normal mode this all will get translated, so AsQueryable is not necessary). In legacy mode we end up client-evaling the whole thing, but we don't restore AsQueryable or apply original indexer or Enumerable.ElementAt.
The text was updated successfully, but these errors were encountered:
Scenario:
when ran in the "legacy" mode, we throw
Here is the shaper that we generate:
and here is the sql:
values parameter is array of strings, and we do read it as IEnumerable initially, but the ElementAt method that we use to get the element we need is on IQueryable, so we try convert to IQueryable and ultimately fail.
In preprocessing we normalize indexer over parameter array into:
[ParameterQueryRootExpression].AsQueryable().ElementAt(...)
, then nav expansion gobbles up AsQueryable call (because in normal mode this all will get translated, so AsQueryable is not necessary). In legacy mode we end up client-evaling the whole thing, but we don't restore AsQueryable or apply original indexer or Enumerable.ElementAt.The text was updated successfully, but these errors were encountered: