This repository was archived by the owner on Dec 14, 2018. It is now read-only.
This repository was archived by the owner on Dec 14, 2018. It is now read-only.
Value type controller properties with [From*] fail with NullRef exception when no value is available #2357
Closed
Description
Scenario:
public class TestController
{
[FromBody]
public int Value { get; set; }
[HttpPost]
public int DoPost()
{
return Value;
}
}
When an invalid value is posted (for instance posting a JSON string here), the binder returns a null value. Attempting to set null
on a value type property fails with a null ref.