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

Precompiled queries: non-captured local variables (e.g. to Skip/Take) aren't handled #35503

Open
roji opened this issue Jan 20, 2025 · 0 comments · May be fixed by #35504
Open

Precompiled queries: non-captured local variables (e.g. to Skip/Take) aren't handled #35503

roji opened this issue Jan 20, 2025 · 0 comments · May be fixed by #35504
Assignees
Labels
area-aot area-query closed-fixed The issue has been fixed and is/will be included in the release indicated by the issue milestone. type-bug
Milestone

Comments

@roji
Copy link
Member

roji commented Jan 20, 2025

Example:

[ConditionalFact]
public virtual Task Skip_with_parameter()
	=> Test(
		"""
var toSkip = 1;
_ = await context.Blogs.OrderBy(b => b.Name).Skip(toSkip).ToListAsync();
""");

Note that captured local variables (e.g. parameters within lambdas) are properly handled; but Skip does not accept a lambda. Also, when a constant is passed to Skip, everything works well. The same thing happens e.g. when a cancellation token local variable is passed to async terminating operators.

Thanks to @ChrisJollyAU for signaling this in #35494 (comment)

@roji roji self-assigned this Jan 20, 2025
@roji roji added this to the 10.0.0 milestone Jan 20, 2025
@roji roji added the closed-fixed The issue has been fixed and is/will be included in the release indicated by the issue milestone. label Jan 20, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-aot area-query closed-fixed The issue has been fixed and is/will be included in the release indicated by the issue milestone. type-bug
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant