Skip to content
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

enum with DisplayAttribute but no Description attribute fails #605

Closed
JonPSmith opened this issue Dec 12, 2016 · 3 comments
Closed

enum with DisplayAttribute but no Description attribute fails #605

JonPSmith opened this issue Dec 12, 2016 · 3 comments
Labels

Comments

@JonPSmith
Copy link

JonPSmith commented Dec 12, 2016

Hi,

The following code fails on the line MyEnums.AndThat.Humanize().

enum MyEnums {
	This, 
	[Display(Name = "Not Set")]
	AndThat
};
void Main()
{
	MyEnums.This.Humanize();
	MyEnums.AndThat.Humanize();
}

I'm not saying its urgent, but thought you should know about it.

@basildk
Copy link
Contributor

basildk commented Dec 17, 2016

The question is what we want to do in this scenario?

  • Return the value of Name (In the example "Not Set")
  • Throw a more meaningfull error

@JonPSmith
Copy link
Author

Personally I think it should return the Name, but Humaized, as that is what the code would have done if no Description attribute was present, i.e. I think the error is not handling the Attribute not being the one it expected.

@clairernovotny
Copy link
Member

Will be fixed in the next release, thanks @basildk!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants