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
The OData client currently supports nullable generic types for enums.
For instance, consider the following Employee class where the EmpType is a generic enum key that can be nullable. This implementation does not result in an exception:
Great catch! I don't think this would be a source or binary breaking change, so I don't think we have to wait for a major release to do this if we introduce a behavior flag.
Related to OData/odata.net/issues/#2964
The OData client currently supports nullable generic types for enums.
For instance, consider the following
Employee
class where theEmpType
is ageneric enum key
that can benullable
. This implementation does not result in an exception:However, based on this spec #secKey, this should throw an exception because:
Assemblies affected
Microsoft.OData.Client 6.x
Reproduce steps
Open the project using either Visual Studio IDE
Navigate to test/FunctionalTests/Microsoft.OData.Client.Tests/Metadata/ClientTypeUtilTests.cs within the
Microsoft.OData.Client.Tests
project.Execute the tests named:
Expected result
An
InvalidOperation
exception with the following Error message should be thrown.Actual result
No error is thrown, and the tests passed.
Additional detail
In src/Microsoft.OData.Client/Metadata/ODataTypeInfo.cs GetKeyProperties(), check if the property type is a nullable generic type first and then throw the expected exception.
Here is the suggested change:
The text was updated successfully, but these errors were encountered: