-
Notifications
You must be signed in to change notification settings - Fork 3.2k
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
Global query filter trigger each other causing stack overflow in EF Core 3.1 #19211
Comments
Global query filters expanding other filers is expected behavior. The best we could do here is throw better exception message then stackoverflow. |
@smitpatel I understand. You can also consider adding it to the breaking api changes of the migration guide, if not to small of a detail. |
ref: #13361 @Andrioden - Thanks. We will add it there too. |
Triage: backlog for better exception message here. |
Duplicate of #17042 |
I don't understand why this is expected behaviour? Why would EF assume a QueryFilter (carefully designed by me) on an entityType needs additional (recursive) Queryfilters to be applied? Suppose I don't want to recursively apply QueryFilters to QueryFilters, what is the easiest way to accomplish this? |
When upgrading from EF Core 2.2.2 to 3.1.0 query filteres changed behavior to causing a stack overflow for my project. After carefully testing this with incremental code changes I am fairly certain that this is because of two different global queries trigger eachother in a loop.
Considering it, I do not find it an unreasonable behavior, but I would expect the behavior to be that global query filters dont trigger other global filters. But if this is expected behavior I respect that and will have to reconsider how to solve this for my situation, which do not have an obvious solution to me.
Steps to reproduce
Here is a stripped version of the relevant code, the actual code is more complex, but should get the point accross.
Model classes
DBContext
Gives
Stack overflow.
in the Visual Studio 2019 "ASP.NET Core Web Server" output window.Works fine
Further technical details
EF Core version: 3.1.0 (I assume it is derived from runtime framework which 3.1.0)
Database provider: Npgsql.EntityFrameworkCore.PostgreSQL
Target framework: netcoreapp3.1
Operating system: Windows 10 Pro
IDE: Microsoft Visual Studio Community 2019, Version 16.4.0
The text was updated successfully, but these errors were encountered: