This is a regression.
_Scenario_:
Scaffolded EF + MVC based controller and attribute routes decorated on them
_Issue_:
When a post request(creating a new person) is being made to the following controller, I see that the 'person' variable is populated but the model state is invalid. Notice that I have a controller-level route here. If I disable the controller-level route, then things work fine as before. Also it works if I use controller-level route differently (check the details at the bottom of this bug)
```
[Route("people/{action=Index}/{id?}")]
public class PeopleController : Controller
{
// POST: /People/Create
// To protect from overposting attacks, please enable the specific properties you want to bind to, for
// more details see http://go.microsoft.com/fwlink/?LinkId=317598.
[HttpPost]
[ValidateAntiForgeryToken]
public async Task<ActionResult> Create([Bind(Include="Id,Name")] Person person)
{
if (ModelState.IsValid)
{
db.People.Add(person);
await db.SaveChangesAsync();
return RedirectToAction("Index");
}
return View(person);
}
```
I noticed the following exception in intellitrace:
_Exception:Thrown: "The parameter conversion from type 'System.Web.Mvc.UrlParameter' to type 'System.Int32' failed because no type converter can convert between these types." (System.InvalidOperationException)_
The following works (__Note__ that the controller-level route here is a bit different than the above scenario):
```
[RoutePrefix("Persons")]
[Route("{action}/{id}")]
public class PersonsController : Controller
{
// POST: Persons/Create
// To protect from overposting attacks, please enable the specific properties you want to bind to, for
// more details see http://go.microsoft.com/fwlink/?LinkId=317598.
[HttpPost]
[Route("Create")]
[ValidateAntiForgeryToken]
public async Task<ActionResult> Create([Bind(Include="Id,Name")] Person person)
{
if (ModelState.IsValid)
{
db.People.Add(person);
await db.SaveChangesAsync();
return RedirectToAction("Index");
}
return View(person);
}
```
_Scenario_:
Scaffolded EF + MVC based controller and attribute routes decorated on them
_Issue_:
When a post request(creating a new person) is being made to the following controller, I see that the 'person' variable is populated but the model state is invalid. Notice that I have a controller-level route here. If I disable the controller-level route, then things work fine as before. Also it works if I use controller-level route differently (check the details at the bottom of this bug)
```
[Route("people/{action=Index}/{id?}")]
public class PeopleController : Controller
{
// POST: /People/Create
// To protect from overposting attacks, please enable the specific properties you want to bind to, for
// more details see http://go.microsoft.com/fwlink/?LinkId=317598.
[HttpPost]
[ValidateAntiForgeryToken]
public async Task<ActionResult> Create([Bind(Include="Id,Name")] Person person)
{
if (ModelState.IsValid)
{
db.People.Add(person);
await db.SaveChangesAsync();
return RedirectToAction("Index");
}
return View(person);
}
```
I noticed the following exception in intellitrace:
_Exception:Thrown: "The parameter conversion from type 'System.Web.Mvc.UrlParameter' to type 'System.Int32' failed because no type converter can convert between these types." (System.InvalidOperationException)_
The following works (__Note__ that the controller-level route here is a bit different than the above scenario):
```
[RoutePrefix("Persons")]
[Route("{action}/{id}")]
public class PersonsController : Controller
{
// POST: Persons/Create
// To protect from overposting attacks, please enable the specific properties you want to bind to, for
// more details see http://go.microsoft.com/fwlink/?LinkId=317598.
[HttpPost]
[Route("Create")]
[ValidateAntiForgeryToken]
public async Task<ActionResult> Create([Bind(Include="Id,Name")] Person person)
{
if (ModelState.IsValid)
{
db.People.Add(person);
await db.SaveChangesAsync();
return RedirectToAction("Index");
}
return View(person);
}
```