-
Notifications
You must be signed in to change notification settings - Fork 475
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
Expand on second level causing error if more than one properties are included in expand on the first level #2017
Comments
Lazy load solves this problem as well as #2016. There is mentioning the discussion about disadvantages of the Lazy load,so far I could not fine any ill effects. SQL seems to be of the same quality and performance does not show any symptoms of degradation. |
Correction, Lazy Load did not solve issue completely. At the same time following requests are working as expected: Bottom line, with or without Lazy Load, there is a bug related in implementation of the "$expand" directive. |
It seems it's same as #2016. |
Yes, it does look very similar to #2016, but this one concentrates on expands on the sub-objects. It is difficult to see from outside what specific parts of the framework are failing, and if internally it is same mechanism. But if those two issues will be merged, please make sure that scenario described here is also tested. |
@xuzhg do you have any updates regarding this? This is a blocker for many people including me willing to upgrade to .NET Core 3.x |
same problem here, any workaround ? |
FYI, just updated Microsoft.AspNetCore.OData to 7.4.0 - still the same error. |
Just updated test application to with preview versions of the components:
error resolved |
Close it since it got fixed after update the EF Core library. |
Expand of the property(properties) on the sub-object is failing if more than one object is included in the expand directive on the first level.
Assemblies affected
Microsoft.AspNetCore.OData 7.3.0
Microsoft.EntityFrameworkCore.SqlServer 3.1.0
Reproduce steps
Send HTTP get request to the following URL:
https://localhost:5001/odata/Books?$expand=Authors,CookBook($expand=Recipes)
Expected result
Service should render object with two sub-objects and expand collection property in the respected sub-object.
Actual result
Application failing with exception:
System.ArgumentOutOfRangeException: Index was out of range. Must be non-negative and less than the size of the collection. (Parameter 'index')
Additional detail
following requests are working as expected:
https://localhost:5001/odata/Books?$expand=Authors,CookBook
https://localhost:5001/odata/Books?$expand=CookBook($expand=Recipes)
you can find source code for the sample project in:
https://github.com/mmichtch/ODataSample
The text was updated successfully, but these errors were encountered: