-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Regression in 1.1 model binding for model types without default constructor #5698
Comments
As a workaround, I have added a default constructor to the model types throwing a NIE. |
Some of the background here can be found in issue #4895. @kichalla fixed that bug in PR #5368. I agree the check for a parameterless constructor should be moved from Nit: |
We will try to get this fixed in the patch. |
This patch bug is approved. Please use the normal code review process w/ a PR and make sure the fix is in the correct branch, then close the bug and mark it as done. |
@kichalla FYI this is an approved patch bug on your plate. |
Done? |
Sorry yeah done. |
Yay! |
In 1.1, the
ComplexTypeModelBinderProvider
started to check for a default constructer: d09e921. This breaks my application.I'm using a controller that calls
TryUpdateModelAsync
with a preconstructedIValueProvider
and model instances:Some of the model types don't have default constructors, most notably because I need some external dependencies for
IValidatableObject
. These model types now don't work anymore and my entire controller action fails.The above commit doesn't really contain any information why this change was introduced and the binder itself doesn't require a default contsructor when the model object is pre-constructed
The text was updated successfully, but these errors were encountered: