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
Request with below $filter will fail
$filter=extension_2782bd535fad492abfcc5ac40ae3a14b_teststring in ('a', 'b')
Expected result
This $filter expression should be correctly parsed with open property as left operand and an array of string as right operand.
Actual result
It hit NullReferenceException at
at Microsoft.OData.Edm.EdmUtil.CheckArgumentNull[T](T value, String parameterName)
at Microsoft.OData.Edm.EdmCollectionType..ctor(IEdmTypeReference elementType)
at Microsoft.OData.UriParser.InBinder.BindInOperator(InToken inToken, BindingState state)
at Microsoft.OData.UriParser.MetadataBinder.Bind(QueryToken token)
at Microsoft.OData.UriParser.FilterBinder.BindFilter(QueryToken filter)
at Microsoft.OData.UriParser.ODataQueryOptionParser.ParseFilter()
Additional detail
It is because of below left.TypeReference is null if left is SingleValueOpenPropertyAccessNode.
We can look at supporting this better (at least not returning a nullref exception), but in the meantime you should be able to do an explicit cast of the open property to make this work:
$filter=cast(extension_2782bd535fad492abfcc5ac40ae3a14b_teststring, Edm.String) in ('a', 'b')
'in' operator can't be used with open property
Assemblies affected
Microsoft.OData.Core 7.7.3
Reproduce steps
Request with below $filter will fail
$filter=extension_2782bd535fad492abfcc5ac40ae3a14b_teststring in ('a', 'b')
Expected result
This $filter expression should be correctly parsed with open property as left operand and an array of string as right operand.
Actual result
It hit NullReferenceException at
at Microsoft.OData.Edm.EdmUtil.CheckArgumentNull[T](T value, String parameterName)
at Microsoft.OData.Edm.EdmCollectionType..ctor(IEdmTypeReference elementType)
at Microsoft.OData.UriParser.InBinder.BindInOperator(InToken inToken, BindingState state)
at Microsoft.OData.UriParser.MetadataBinder.Bind(QueryToken token)
at Microsoft.OData.UriParser.FilterBinder.BindFilter(QueryToken filter)
at Microsoft.OData.UriParser.ODataQueryOptionParser.ParseFilter()
Additional detail
It is because of below left.TypeReference is null if left is SingleValueOpenPropertyAccessNode.
File: https://github.com/OData/odata.net/blob/master/src/Microsoft.OData.Core/UriParser/Binders/InBinder.cs
Line: 48
The text was updated successfully, but these errors were encountered: