Closed sid-6581 closed 1 month ago
cc: @BenjaminBrienen
Opened an issue in the relevant repository:
https://github.com/dotnet/efcore/issues/34767
This issue can be closed, I think. @josefpihrt
Even if they add that in another version of EF Core (and they're notoriously understaffed and slow to do so), RCS1077 will be very annoying to leave enabled in any project that uses any version of EF Core that doesn't support it, which will be the majority of projects for a while. RCS1077 has enough other useful suggestions that I don't want to disable it completely, but it's also very frustrating to pragma disable it in all my queries that use ordering. This is something that should be handled properly in Roslynator.
So Roslynator should special case every project that doesn't properly support IEnumberable methods?
This isn't an IEnumerable
method, it's an IQueryable
method:
https://learn.microsoft.com/en-us/dotnet/api/System.Linq.Queryable.OrderBy?view=net-8.0
Roslynator shouldn't suggest this for the IQueryable
versions.
I agree with @sid-6581 that it shouldn't be suggested for IQueryable
.
This issue is already fixed in EFCore. You need to update your dependency: https://github.com/dotnet/efcore/issues/28634
https://github.com/dotnet/core/releases/tag/v9.0.0-rc.1
It is currently in release candidate status.
As I explained above,that's not an acceptable solution. I'm on the latest released version, EF Core 9 won't be out until later this year, and even then, most people won't update immediately.
I think everyone expressed their opinion.
This needs to be fixed. Best would if it would be fixed by you, @BenjaminBrienen, as you implemented it. Let me know if you will be able to fix it in a next couple of days (The fix should be straightforward).
I'm busy with other projects at the moment, sorry.
Product and Version Used: 4.12.6
Steps to Reproduce:
Use
OrderBy(x => x)
in an EF Core LINQ expression.Actual Behavior:
Roslynator will suggest changing it to
Order()
, which isn't currently supported in EF Core as of version 8. UsingOrder()
will cause the code to fail at runtime when it can't be translated to SQL.Expected Behavior:
OrderBy()
used on anything that implementsIQueryable
should not trigger this suggestion.