-
Notifications
You must be signed in to change notification settings - Fork 10.4k
Fail ComplexTypeModelBinder
after CanCreateModel(...)
in some cases
#6793
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
@rynowak this is a suggestion for the bug we were discussing today WIP because I haven't added applicable tests nor updated one existing test that now fails (because the relevant validation is not done anymore -- the container is now |
src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/ModelBinding/Binders/ComplexTypeModelBinder.cs
Outdated
Show resolved
Hide resolved
src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/ModelBinding/Binders/ComplexTypeModelBinder.cs
Show resolved
Hide resolved
src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/ModelBinding/Binders/ComplexTypeModelBinder.cs
Show resolved
Hide resolved
src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/ModelBinding/Binders/ComplexTypeModelBinder.cs
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The fix looks good so far. Waiting to see tests for impacted scenarios
6958d26
to
02a8adc
Compare
🆙📅 |
ComplexTypeModelBinder
after CanCreateModel(...)
in some casesComplexTypeModelBinder
after CanCreateModel(...)
in some cases
02a8adc
to
2682923
Compare
🆙📅 to cover #6616 scenario as well |
|
||
var binder = new Mock<TestableComplexTypeModelBinder>() { CallBase = true }; | ||
var binder = new Mock<TestableComplexTypeModelBinder>(binders) { CallBase = true }; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Required now because of the check at https://github.com/aspnet/AspNetCore/pull/6793/files#diff-44e4a40c4a5c7c29dd5892f664b5b362R142 (Didn't like the idea of adding another protected virtual
method for two tests.)
/cc @pranavkm |
- cover #6616 cases nit: improve added test name
2682923
to
9630151
Compare
|
||
Assert.True(modelState.IsValid); | ||
} | ||
|
||
private static void SetJsonBodyContent(HttpRequest request, string content) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Rewritten to allow method to be called more than once and to use separate body and part headers
Bump @rynowak |
Uh oh!
There was an error while loading. Please reload this page.