-
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
EF Core 6 - Unable to translate a collection subquery in a projection #28130
Comments
Note from triage: The 3.1 behavior generated incorrect results. @maumar to look for relevant issue. |
relevant issue: #15873 |
Sorry, I'm trying to understand the replies. |
@arthur-liberman Yes, 3.1 was not failing, but the SQL generated returned incorrect results. 6.0 now returns correct results where it can, or throws when the translation is not possible. You should consider changing your queries so that they can be translated; @smitpatel or @maumar may be able to provide some pointers. It's very unlikely anything will change here in either 3.1 or 6.0. |
@arthur-liberman I am also fighting this issue, trying to update from 3.1 to 6. I keep seeing this "returned incorrect results" reply, but it's objectively not the case that the results were ever inaccurate. This pattern has been in production for over a year in a mission-critical application, if it was inaccurate we'd have a bug about it. I am not sure what this "inaccurate" comment means, and it doesn't help the broken code. Same situation -- the code in question for us doesn't use Distinct or GroupBy whatsoever. I've isolated the problematic spots, and based on the answers I have been seeing, it sounds like the actual response here is "re-write your code". It's only months of development, nbd. |
@cmbkla agreed. In our use case we have not observed any issues. We are still working on getting the port finished, so have not performed a full system test yet. |
@smitpatel to detail cases where we cannot translate. |
Wrote detailed response in #23830 (comment) This is by design. It cannot generate correct results in all scenario. The correct results happens only in certain kind of data by co-incidence. Any change in underlying data can start generating wrong results. |
I'm porting our code from .NET Core 3.1 to .NET 6. The issue seems to be a regression from our POV, because it used to work correctly in 3.1 and also in 2.1 if I remember correctly.
We have a query constructed from a table left joined with a view. There's a one-to-many navigation property tied to this table.
If I access the list when constructing the DTO, I get the following exception:
If I join the table used by the view instead, everything works fine.
To reproduce:
csproj:
Code:
As mentioned above, in 3.1.11 we did not have this problem.
Currently using the latest available .NET SDK, 6.0.5.
The text was updated successfully, but these errors were encountered: