Skip to content

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

Merged
merged 4 commits into from
Feb 13, 2019

Conversation

dougbu
Copy link
Contributor

@dougbu dougbu commented Jan 17, 2019

@dougbu dougbu requested a review from rynowak January 17, 2019 06:22
@dougbu
Copy link
Contributor Author

dougbu commented Jan 17, 2019

@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 null).

Copy link
Member

@rynowak rynowak left a 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

@Eilon Eilon added the area-mvc Includes: MVC, Actions and Controllers, Localization, CORS, most templates label Jan 18, 2019
@dougbu dougbu force-pushed the dougbu/fail.complexmodelbinder.4802 branch from 6958d26 to 02a8adc Compare January 27, 2019 21:52
@dougbu
Copy link
Contributor Author

dougbu commented Jan 27, 2019

🆙📅

@dougbu dougbu changed the title WIP: Fail ComplexTypeModelBinder after CanCreateModel(...) in some cases Fail ComplexTypeModelBinder after CanCreateModel(...) in some cases Jan 27, 2019
@dougbu dougbu force-pushed the dougbu/fail.complexmodelbinder.4802 branch from 02a8adc to 2682923 Compare January 31, 2019 05:57
@dougbu
Copy link
Contributor Author

dougbu commented Jan 31, 2019

🆙📅 to cover #6616 scenario as well


var binder = new Mock<TestableComplexTypeModelBinder>() { CallBase = true };
var binder = new Mock<TestableComplexTypeModelBinder>(binders) { CallBase = true };
Copy link
Contributor Author

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.)

@dougbu
Copy link
Contributor Author

dougbu commented Feb 1, 2019

/cc @pranavkm

@dougbu dougbu force-pushed the dougbu/fail.complexmodelbinder.4802 branch from 2682923 to 9630151 Compare February 3, 2019 06:22

Assert.True(modelState.IsValid);
}

private static void SetJsonBodyContent(HttpRequest request, string content)
Copy link
Contributor Author

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

@dougbu
Copy link
Contributor Author

dougbu commented Feb 11, 2019

Bump @rynowak

@dougbu dougbu merged commit 5bbf710 into master Feb 13, 2019
@dougbu dougbu deleted the dougbu/fail.complexmodelbinder.4802 branch February 13, 2019 06:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-mvc Includes: MVC, Actions and Controllers, Localization, CORS, most templates
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants