I get the following error when I have an entity with a nullable collection:
System.ArgumentException occurred
_HResult=-2147024809
_message=The argument must be of type 'IEnumerable'.
HResult=-2147024809
IsTransient=false
Message=The argument must be of type 'IEnumerable'.
Parameter name: graph
Source=System.Web.Http.OData
ParamName=graph
StackTrace:
at System.Web.Http.OData.Formatter.Serialization.ODataCollectionSerializer.CreateODataValue(Object graph, IEdmTypeReference expectedType, ODataSerializerContext writeContext)
InnerException:
If it's an empty list, the error is not thrown. I would expect a better error message when the collection is null, since that error does not provide any insight as to what is the root cause of the problem.
System.ArgumentException occurred
_HResult=-2147024809
_message=The argument must be of type 'IEnumerable'.
HResult=-2147024809
IsTransient=false
Message=The argument must be of type 'IEnumerable'.
Parameter name: graph
Source=System.Web.Http.OData
ParamName=graph
StackTrace:
at System.Web.Http.OData.Formatter.Serialization.ODataCollectionSerializer.CreateODataValue(Object graph, IEdmTypeReference expectedType, ODataSerializerContext writeContext)
InnerException:
If it's an empty list, the error is not thrown. I would expect a better error message when the collection is null, since that error does not provide any insight as to what is the root cause of the problem.