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

SelectExpandQueryValidator throws when $selecting complex property (EDM loaded from CSDL) #829

Closed
mjameson-se opened this issue Jan 31, 2023 · 1 comment · Fixed by #830
Assignees
Labels
bug Something isn't working

Comments

@mjameson-se
Copy link

Using the latest on main (trying to debug the other issues I've run into in released versions)

Unable to cast object of type 'Microsoft.OData.Edm.Csdl.CsdlSemantics.CsdlSemanticsNamedTypeReference' to type 'Microsoft.OData.Edm.IEdmComplexTypeReference'."
at Microsoft.AspNetCore.OData.Query.Validator.SelectExpandQueryValidator.GetStructuredType(IEdmTypeReference typeRef)
at Microsoft.AspNetCore.OData.Query.Validator.SelectExpandQueryValidator.ValidatePathSelectItem(PathSelectItem pathSelectItem, SelectExpandValidatorContext validatorContext)
at Microsoft.AspNetCore.OData.Query.Validator.SelectExpandQueryValidator.ValidateSelectExpand(SelectExpandClause selectExpandClause, SelectExpandValidatorContext validatorContext)
at Microsoft.AspNetCore.OData.Query.Validator.SelectExpandQueryValidator.Validate(SelectExpandQueryOption selectExpandQueryOption, ODataValidationSettings validationSettings)
at Microsoft.AspNetCore.OData.Query.SelectExpandQueryOption.Validate(ODataValidationSettings validationSettings)
at Microsoft.AspNetCore.OData.Query.Validator.ODataQueryValidator.Validate(ODataQueryOptions options, ODataValidationSettings validationSettings)
at Microsoft.AspNetCore.OData.Query.ODataQueryOptions.Validate(ODataValidationSettings validationSettings)
at Microsoft.AspNetCore.OData.Query.EnableQueryAttribute.ValidateQuery(HttpRequest request, ODataQueryOptions queryOptions)
at Microsoft.AspNetCore.OData.Query.EnableQueryAttribute.OnActionExecuting(ActionExecutingContext actionExecutingContext)

This error does not occur in the released 8.0.12 version. Note that GetStructuredType seems to be superfluous as odata.net has an extension method .ToStructuredType() which works correctly in this case.

@mjameson-se mjameson-se added the bug Something isn't working label Jan 31, 2023
@xuzhg xuzhg self-assigned this Jan 31, 2023
xuzhg added a commit that referenced this issue Jan 31, 2023
… property (#830)

* fixes #829, SelectExpandQueryValidator throws when $selecting complex property

* update the xml
@xuzhg
Copy link
Member

xuzhg commented Jan 31, 2023

@mjameson-se would you please try the latest main code bases?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants