Invoke filter not working

Now I get a 500 Internal error. Here are the details.

ArgumentException: Expression of type 'System.Collections.Generic.List1[System.Nullable1[System.Int32]]' cannot be used for parameter of type 'System.Collections.Generic.IEnumerable1[System.Int32]' of method 'Boolean Contains[Int32](System.Collections.Generic.IEnumerable1[System.Int32], Int32)' Parameter name: arg0

Can you post ProducerId property definition from the class in server/Models? In my case OrderId is nullable:

    public int? OrderId

From the ProducerAuctions that is being queried it is not nullable.

public partial class ProducerAuction
public int ProducerId

public Producer Producer { get; set; }
public int AuctionId

This is very strange. I've just tried query on non nullable property (Quantity) however everything worked normally:

Can you post the full stack trace of the exception?

I believe this is what you are looking for.

System.ArgumentException: Expression of type 'System.Collections.Generic.List1[System.Nullable1[System.Int32]]' cannot be used for parameter of type 'System.Collections.Generic.IEnumerable1[System.Int32]' of method 'Boolean Contains[Int32](System.Collections.Generic.IEnumerable1[System.Int32], Int32)'
Parameter name: arg0
at System.Dynamic.Utils.ExpressionUtils.ValidateOneArgument(MethodBase method, ExpressionType nodeKind, Expression arguments, ParameterInfo pi, String methodParamName, String argumentParamName, Int32 index)
at System.Linq.Expressions.Expression.Call(Expression instance, MethodInfo method, Expression arg0, Expression arg1)
at Microsoft.AspNet.OData.Query.Expressions.FilterBinder.BindExpression(SingleValueNode expression, RangeVariable rangeVariable, Type elementType)
at Microsoft.AspNet.OData.Query.Expressions.FilterBinder.BindFilterClause(FilterBinder binder, FilterClause filterClause, Type filterType)
at Microsoft.AspNet.OData.Query.FilterQueryOption.ApplyTo(IQueryable query, ODataQuerySettings querySettings)
at Microsoft.AspNet.OData.Query.ODataQueryOptions.ApplyTo(IQueryable query, ODataQuerySettings querySettings)
at Microsoft.AspNet.OData.EnableQueryAttribute.ExecuteQuery(Object responseValue, IQueryable singleResultCollection, IWebApiActionDescriptor actionDescriptor, Func2 modelFunction, IWebApiRequestMessage request, Func2 createQueryOptionFunction)
at Microsoft.AspNet.OData.EnableQueryAttribute.OnActionExecuted(Object responseValue, IQueryable singleResultCollection, IWebApiActionDescriptor actionDescriptor, IWebApiRequestMessage request, Func2 modelFunction, Func2 createQueryOptionFunction, Action1 createResponseAction, Action3 createErrorAction)
at Microsoft.AspNet.OData.EnableQueryAttribute.OnActionExecuted(ActionExecutedContext actionExecutedContext)
at Microsoft.AspNetCore.Mvc.Filters.ActionFilterAttribute.OnActionExecutionAsync(ActionExecutingContext context, ActionExecutionDelegate next)
at Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker.InvokeNextActionFilterAsync()
at Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker.Rethrow(ActionExecutedContext context)
at Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted)
at Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker.InvokeInnerFilterAsync()
at Microsoft.AspNetCore.Mvc.Internal.ResourceInvoker.InvokeNextResourceFilter()
at Microsoft.AspNetCore.Mvc.Internal.ResourceInvoker.Rethrow(ResourceExecutedContext context)
at Microsoft.AspNetCore.Mvc.Internal.ResourceInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted)
at Microsoft.AspNetCore.Mvc.Internal.ResourceInvoker.InvokeFilterPipelineAsync()
at Microsoft.AspNetCore.Mvc.Internal.ResourceInvoker.InvokeAsync()
at Microsoft.AspNetCore.Builder.RouterMiddleware.Invoke(HttpContext httpContext)
at Microsoft.AspNetCore.Diagnostics.DeveloperExceptionPageMiddleware.Invoke(HttpContext context)

Unfortunately I've just found this:

The only workaround I can think of right now is to use custom server method instead In filter.

Could I simply modify the database to allow nulls and re-infer the database? I can simply set the values to be required at the screen level at that point correct?

You can actually query against the expanded property (add Producer as $expand parameter for the second invoke)

and write the following raw $filter query:

Order/Id in (${ => i.Id)})

1 Like

That worked! Thank you. So a quick clarification on using that result.value in filters. Can I go multiple levels deep? I actually need to go one level deeper with another nested then. I think I'll work on that one in the morning. When I use that is it always going to pull the result value of the direct parent invoke?

Also on an unrelated note how to I renew my subscription for professional? I believe it has been longer than 1 year since I purchased it.

Thank you very much,


Yep, you can use parent query result as ${result.value} in the nested invoke. I think you still have time left till 1st of October this year. :slight_smile: The subscription is automatic, you do not need to do anything.