Quantcast
Channel: ASP.NET MVC / Web API / Web Pages
Viewing all articles
Browse latest Browse all 7925

Edited Issue: Poor error message when a collection property is null [1328]

$
0
0
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.

Viewing all articles
Browse latest Browse all 7925

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>