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
LINQ: the in-memory rewriter cache keeps captured variables from the first call, so later queries return stale results #207
ExecuteViaEnumerableRewriter caches the compiled delegate under typeof(TResult).FullName + expression.ToString() (BTreeQueryProvider.cs:702-726). ToString() prints a captured variable as the closure field access, not its value, and the quoted lambdas are compiled with the first call's closure object baked in. A later call with a different captured value reuses that delegate and returns the first call's result. No error is raised.
The same happens with Where(...).Count(pred) and with every other shape that falls back to the rewriter. Open PRs #180 and #193 route more shapes through it (Select(...).Count(a => a > t), OrderBy(idx).Take(20).Count(p => p.Age < t)).
Expected
Each call uses its own captured values.
Possible fix
Key the cache on the expression shape with closure constants replaced by parameters, and pass the captured values in as arguments at execution; or don't cache delegates for expressions that contain closure constants.
Activity
fix(linq): pass constants to cached rewriter delegates on every call (#…