Skip to content

Precompiled Queries fail for captured parameters #35887

Description

@vancodocton

Type of issue

Code doesn't work

Description

Hello.

I tried to use precompiled queries in EF9 by following the instructions in this page. However, it always end up with:

    D:\packages\NuGet\cache\microsoft.entityframeworkcore.tasks\9.0.3\buildTransitive\Microsoft.EntityFrameworkCore.Tasks.targets(93,5): error : Query precompilation failed with errors:
    D:\packages\NuGet\cache\microsoft.entityframeworkcore.tasks\9.0.3\buildTransitive\Microsoft.EntityFrameworkCore.Tasks.targets(93,5): error : QueryPrecompilationError { SyntaxNode = context.Todos.OrderBy(b => b.Id).AsAsyncEnumerable(), Exception = System.InvalidOperationException: Dynamic LINQ queries are not supported when precompiling queries. }
    D:\packages\NuGet\cache\microsoft.entityframeworkcore.tasks\9.0.3\buildTransitive\Microsoft.EntityFrameworkCore.Tasks.targets(93,5): error :

when I run dotnet publish -r win-x64 -o publish

Here is my minimal repro:
https://github.com/vancodocton/NativeAot/tree/9813f8ec755f6149bc9209a54b288e44d2f89f5f

Page URL

https://learn.microsoft.com/en-us/ef/core/performance/nativeaot-and-precompiled-queries

Content source URL

https://github.com/dotnet/EntityFramework.Docs/blob/main/entity-framework/core/performance/nativeaot-and-precompiled-queries.md

Document Version Independent Id

d0be1f4d-9f8a-2547-ce96-8ed38a4be225

Platform Id

134032fb-f272-255a-1b6a-4858e71e1c88

Article author

@roji

Activity

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

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions