Assemblies affected
This issue is similar to #1416
The issue occurs in Microsoft.AspNetCore.OData versions starting from 8.0.5 and up. The last known working version is 8.0.4.
Describe the bug
A regression occurs when using $orderby=COMPUTED_PROP_NAME in OData queries. The query that worked in Microsoft.AspNetCore.OData version 8.0.4 now fails in versions 8.0.5 and later.
Reproduce steps
- Create a new ASP.NET Core Web API project with OData setup.
- Add the Microsoft.AspNetCore.OData NuGet package version 8.0.4.
- Add a computed parameter to your query string and reference it in the orderby parameter:
GET http://localhost:5050/odata/MyEntities?$compute=age add 10 as agePlusTen&$orderby=agePlusTen desc&$select=id, name, agePlusTen&$filter=agePlusTen ge 21
This query works successfully in version 8.0.4, but fails in all subsequent versions. In all version the computed field works in $select and $filter, but $orderby doesn't work after 8.0.4