After upgrading Microsoft.OData.Core from 8.4.2 to 8.4.3, queries using the in() operator on a nullable enum property fail when null is included in the value list.
This worked correctly in 8.4.2, but in 8.4.3 it throws:
Microsoft.OData.ODataException: The string 'null' is not a valid enumeration type constant.
Stack trace indicates the failure originates from enum constant validation logic inside:
MetadataBindingUtils.cs
The failure occurs specifically during:
queryOptions.Validate(validationSettings);
We assume this issue may be related to the recent flag enum support changes introduced in commit #3324
public enum Status
{
New = 1,
Active = 2,
Closed = 3
}
public class Order
{
public int Id { get; set; }
// Nullable enum
public Status? Status { get; set; }
}
Failing Url
GET https://localhost:5001/odata/Orders?$filter=Status in (null, 'Active')
Assemblies affected
Microsoft.OData.Core 8.4.3
After upgrading Microsoft.OData.Core from 8.4.2 to 8.4.3, queries using the in() operator on a nullable enum property fail when null is included in the value list.
This worked correctly in 8.4.2, but in 8.4.3 it throws:
Microsoft.OData.ODataException: The string 'null' is not a valid enumeration type constant.Stack trace indicates the failure originates from enum constant validation logic inside:
MetadataBindingUtils.csThe failure occurs specifically during:
queryOptions.Validate(validationSettings);We assume this issue may be related to the recent flag enum support changes introduced in commit #3324
Failing Url
GET https://localhost:5001/odata/Orders?$filter=Status in (null, 'Active')Assemblies affected
Microsoft.OData.Core 8.4.3