-
Notifications
You must be signed in to change notification settings - Fork 2.1k
ModelBinder attribute attached to a class has no effect (broken in rc2-final) #4652
Comments
I can reproduce this issue. The |
🆒 bug 😎 Well Probably best for This issue affects at least
|
Umm, and add a unit test? 😄 |
@Eilon well I've fixed the bug while proving to myself I understood it. So why not 😺 |
- #4652 - previously ignored for top-level models - `ModelBinderProviderContext.BindingInfo` is now never `null` - similarly, use type metadata (as well as parameter info) for `ModelBindingContext.BinderModelName` - previously ignored when overridden in `ControllerArgumentBinder`
- #4652 - previously ignored for top-level models - `ModelBinderProviderContext.BindingInfo` is now never `null` - similarly, use type metadata (as well as parameter info) for `ModelBindingContext.BinderModelName` - previously ignored when overridden in `ControllerArgumentBinder`
- #4652 - previously ignored for top-level models - `ModelBinderProviderContext.BindingInfo` is now never `null` - similarly, use type metadata (as well as parameter info) for `ModelBindingContext.BinderModelName` - previously ignored when overridden in `ControllerArgumentBinder`
- #4652 - previously ignored for top-level models - `ModelBinderProviderContext.BindingInfo` is now never `null` - similarly, use type metadata (as well as parameter info) for `ModelBindingContext.BinderModelName` - previously ignored when overridden in `ControllerArgumentBinder`
Is there a work around for this (if we want to keep using rc2-final)?? |
@dougbu I don't know if this is working. The attribute seems to have no effect in my code. Model binders are still called in order like normal, the attribute does nothing. [HttpGet]
public async Task<IActionResult> Get([ModelBinder(BinderType = typeof(MyModelBinder))] int userId)
{
// stuff
} |
@vaindil please open a new issue describing the exact scenario where you're seeing a regression of this fix. I assume you are using an Mvc package more recent than 1.0.0. But, please include the |
I have a model class and a binder:
Usage:
In rc2, the binder isn't invoked, but the same approach works fine with classic MVC 5 and DNX rc1-final.
Full sample: https://github.com/AlekseyMartynov/aspnetcore-rc2-modelbinding
The text was updated successfully, but these errors were encountered: