Skip to content

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

Closed

Description

@roji

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)

Activity

  1. self-assigned this
    on Jan 20, 2025
  2. added a commit that references this issue on Jan 20, 2025
    546845c
  3. added this to the 10.0.0 milestone on Jan 20, 2025
  4. added a commit that references this issue on Jan 23, 2025
    3f4a274
  5. added theissue type on Jun 15, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions