You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm working with OData and I've encountered an issue when using the $compute and $select query options with properties of type array. Here's what I'm trying to achieve:
Query URL for Non-Array Property (Working):
http://host/odata/MyEntity?$compute=int as myint,string as mystring &$select=myint,mystring
This URL works as expected. It returns the myint and mystring properties in the response, replacing the original entity properties int and string.
Query URL for Array Property (Not Working):
http://host/odata/MyEntity?$compute=array as myarray&$select=myarray
This URL results in an error. I want to transform the array property into myarray in the response, similar to how it works with non-array properties.
Error Details:
I am receiving the following error when attempting the second query:
Error Message:
"Message": "Object reference not set to an instance of an object."
Stack Trace:
atMicrosoft.OData.UriParser.ComputeBinder.BindComputeExpressionToken(ComputeExpressionTokentoken)
at Microsoft.OData.UriParser.ComputeBinder.BindCompute(ComputeTokentoken)
at Microsoft.OData.UriParser.ODataQueryOptionParser.ParseComputeImplementation(Stringcompute,ODataUriParserConfigurationconfiguration,ODataPathInfoodataPathInfo)
at Microsoft.OData.UriParser.ODataQueryOptionParser.ParseCompute()
at Microsoft.AspNetCore.OData.Query.ComputeQueryOption.get_ComputeClause()
at Microsoft.AspNetCore.OData.Query.Validator.ComputeQueryValidator.Validate(ComputeQueryOptioncomputeQueryOption,ODataValidationSettingsvalidationSettings)
at Microsoft.AspNetCore.OData.Query.ComputeQueryOption.Validate(ODataValidationSettingsvalidationSettings)
at Microsoft.AspNetCore.OData.Query.Validator.ODataQueryValidator.Validate(ODataQueryOptionsoptions,ODataValidationSettingsvalidationSettings)
at Microsoft.AspNetCore.OData.Query.ODataQueryOptions.Validate(ODataValidationSettingsvalidationSettings)
at Microsoft.AspNetCore.OData.Query.EnableQueryAttribute.ValidateQuery(HttpRequestrequest,ODataQueryOptionsqueryOptions)
at Microsoft.AspNetCore.OData.Query.EnableQueryAttribute.OnActionExecuting(ActionExecutingContextactionExecutingContext)
at Microsoft.AspNetCore.Mvc.Filters.ActionFilterAttribute.OnActionExecutionAsync(ActionExecutingContextcontext,ActionExecutionDelegatenext)
at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.<InvokeNextActionFilterAsync>g__Awaited|10_0(ControllerActionInvokerinvoker,TasklastTask,Statenext,Scopescope,Objectstate,BooleanisCompleted)
at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.Rethrow(ActionExecutedContextSealedcontext)
at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.Next(State&next,Scope&scope,Object&state,Boolean&isCompleted)
at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.InvokeInnerFilterAsync()---Endof stack trace from previous location---\n
at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.<InvokeNextExceptionFilterAsync>g__Awaited|26_0(ResourceInvokerinvoker,TasklastTask,Statenext,Scopescope,Objectstate,BooleanisCompleted)
at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.Rethrow(ExceptionContextSealedcontext)
at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.Next(State&next,Scope&scope,Object&state,Boolean&isCompleted)
at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.InvokeNextResourceFilter()---Endof stack trace from previous location---\n
at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.Rethrow(ResourceExecutedContextSealedcontext)
at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.Next(State&next,Scope&scope,Object&state,Boolean&isCompleted)
at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.InvokeFilterPipelineAsync()---Endof stack trace from previous location---\n
at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.<InvokeAsync>g__Logged|17_1(ResourceInvokerinvoker)
at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.<InvokeAsync>g__Logged|17_1(ResourceInvokerinvoker)
at Microsoft.AspNetCore.Routing.EndpointMiddleware.<Invoke>g__AwaitRequestTask|7_0(Endpointendpoint,TaskrequestTask,ILoggerlogger)
at Microsoft.AspNetCore.Authorization.AuthorizationMiddleware.Invoke(HttpContextcontext)
at Microsoft.AspNetCore.Authentication.AuthenticationMiddleware.Invoke(HttpContextcont...
I'm working with OData and I've encountered an issue when using the $compute and $select query options with properties of type array. Here's what I'm trying to achieve:
Query URL for Non-Array Property (Working):
http://host/odata/MyEntity?$compute=int as myint,string as mystring &$select=myint,mystring
This URL works as expected. It returns the myint and mystring properties in the response, replacing the original entity properties int and string.
Query URL for Array Property (Not Working):
http://host/odata/MyEntity?$compute=array as myarray&$select=myarray
This URL results in an error. I want to transform the array property into myarray in the response, similar to how it works with non-array properties.
Error Details:
I am receiving the following error when attempting the second query:
Error Message:
"Message": "Object reference not set to an instance of an object."
Stack Trace:
Ported from Stackoverflow at here.
The text was updated successfully, but these errors were encountered: