In MVC4, Url.Action (and similar functions) that take an 'object' of route values would construct a route value dictionary directly and rely on the logic inside the RouteValueDictionary class to construct the set of properties and values.
In MVC5 we attempted to optimize this code path by using a cached reflection system - this has the side-effect of ignoring inherited properties and ignoring the TypeDescriptor - which is used by RouteValueDictionary
Expected:
~/?Bar=cool&Foo=Uncool
Actual:
~/?Bar=cool
'''
public class HomeController : Controller
{
//
// GET: /Home/
[Route("")]
public string Index()
{
return Url.Action("Index", "Home", new D() { Bar = "cool", Foo = "Uncool" });
}
private class D : B
{
public string Bar { get; set; }
}
private class B
{
public string Foo { get; set; }
}
}
}
'''
Comments: The proposed fix affects both WebAPI & MVC (HttpRouteValueDictionary and RouteValueDictionary construction in URL helpers)
In MVC5 we attempted to optimize this code path by using a cached reflection system - this has the side-effect of ignoring inherited properties and ignoring the TypeDescriptor - which is used by RouteValueDictionary
Expected:
~/?Bar=cool&Foo=Uncool
Actual:
~/?Bar=cool
'''
public class HomeController : Controller
{
//
// GET: /Home/
[Route("")]
public string Index()
{
return Url.Action("Index", "Home", new D() { Bar = "cool", Foo = "Uncool" });
}
private class D : B
{
public string Bar { get; set; }
}
private class B
{
public string Foo { get; set; }
}
}
}
'''
Comments: The proposed fix affects both WebAPI & MVC (HttpRouteValueDictionary and RouteValueDictionary construction in URL helpers)