Skip to content
This repository has been 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
pranavkm opened this issue Apr 8, 2015 · 0 comments
Assignees
Milestone

Comments

@pranavkm
Copy link
Contributor

pranavkm commented Apr 8, 2015

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.

@pranavkm pranavkm added the bug label Apr 8, 2015
@danroth27 danroth27 added this to the 6.0.0-beta5 milestone Apr 8, 2015
harshgMSFT added a commit that referenced this issue Apr 21, 2015
harshgMSFT added a commit that referenced this issue Apr 21, 2015
harshgMSFT added a commit that referenced this issue Apr 22, 2015
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants