Quantcast
Channel: ASPNETWebStack Issue Tracker Rss Feed
Viewing all articles
Browse latest Browse all 7215

Created Issue: ModelBinder errors (parse) for required action parameters result in the action not getting executed. [942]

$
0
0
```
public class CustomersController : ApiController
{
public Customer GetCustomer(int key)
{
return null;
}
}
```

Use the url http://localhost/MyTypes/2886753098675309

This should fail to parse as 2886753098675309 is too big for an int.

Expectation: The controller action gets invoked, with model state errors - or at least a better error message that contains the model state errors.

Result:

```
{
"Message": "The request is invalid.",
"MessageDetail": "The parameters dictionary contains a null entry for parameter 'key' of non-nullable type 'System.Int32' for method 'RuntimeTests.Customer GetCustomer(Int32)' in 'RuntimeTests.CustomersController'. An optional parameter must be a reference type, a nullable type, or be declared as an optional parameter."
}
```

See http://aspnetwebstack.codeplex.com/workitem/936 for how this makes OData scenarios harder.

Viewing all articles
Browse latest Browse all 7215

Trending Articles



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