Skip to content
This repository was archived by the owner on Dec 14, 2018. It is now read-only.
This repository was archived by the owner on Dec 14, 2018. It is now read-only.

ModelBinderAttribute should not throw from BinderType property setter #2326

Closed
@pranavkm

Description

@pranavkm

https://github.com/aspnet/Mvc/blob/dev/src/Microsoft.AspNet.Mvc.ModelBinding/BinderMetadata/ModelBinderAttribute.cs#L34-L57

The BinderType setter throws when the type is not an IModelBinder. This is problematic since reflecting over the type decorated with the attribute would produce an exception. We already throw from the code consuming the attribute, which should suffice.

Example:

[ModelBinder(BinderType = typeof(string)]
public class MyModel {}

typeof(MyModel).GetCustomAttributes() <-- will throw

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions