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

EFCore will break on Net6 cause Queryable class will be extended and EF Core Reflection will break #24002

Closed
jogibear9988 opened this issue Jan 27, 2021 · 5 comments · Fixed by #24090
Assignees
Labels
area-query closed-fixed The issue has been fixed and is/will be included in the release indicated by the issue milestone. customer-reported Servicing-approved type-bug
Milestone

Comments

@jogibear9988
Copy link

EFCore reflection will break when this Issue is fixed and will be merged into NET6

dotnet/runtime#28776

Problem is EFCore only checks for Parameter count and uses "Single", so it will crash cause there will be now 2 Methods with same Parameter Count:

ElementAt = queryableMethods.Single(

EFCore should switch to a safer reflection like done in Linq2db:
https://github.com/linq2db/linq2db/blob/37d0f108214c2fc0e6f1991c9d08627c605a9241/Source/LinqToDB/Reflection/Methods.cs#L42
or in NHibernate
https://github.com/nhibernate/nhibernate-core/blob/master/src/NHibernate/Util/ReflectionCache.cs

@eiriktsarpalis
Copy link
Member

Related to #23996.

@roji
Copy link
Member

roji commented Jan 28, 2021

Unless I'm mistaken, this should also be backported otherwise older EF running on newer BCLs would also break...

@jogibear9988
Copy link
Author

@roji yes, all versions without propper fix will not work on net6.
I think not only ElementAt should be fixed, all reflection code for method finding should be changed to be more stable (compare parameter types, not only count)

@ajcvickers
Copy link
Member

Notes from triage: @smitpatel to follow up on:

  • Which releases of EF Core are broken
  • Whether or not EF6 is broken

@smitpatel
Copy link
Member

PRs out for 3.1/5.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-query closed-fixed The issue has been fixed and is/will be included in the release indicated by the issue milestone. customer-reported Servicing-approved type-bug
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants