Open
Description
Is there an existing issue for this?
- I have searched the existing issues
Describe the bug
Model binding fails when a [FormQuery] parameter has the same name as a property of the model.
public class TestParameter
{
public string Parameter { get; set; };
}
[ApiController]
public class TestController()
{
[HttpGet("test")]
public TestParameter Test([FromQuery] TestParameter parameter)
{
return parameter;
}
}
HTTP GET /test?Parameter=test
{
"parameter": null
}
Looks like it's related to here
When the name of the model is the same as the model attribute name, the binding intention cannot be easily determined by the prefix
Expected Behavior
HTTP GET /test?Parameter=test
{
"parameter": "test"
}
Steps To Reproduce
No response
Exceptions (if any)
No response
.NET Version
9.0.100-preview.7.24407.12
Anything else?
No response