Invalid Inspection Error on DisplayNameAttribute
This is only a minor bug, but a bug all the same. ReSharper 5.1.1752.41 adds an inspection error to the DisplayNameAttribute(string displayName) constructor's 'displayName' parameter reading 'Localizable string: "foo"'. This is not a valid error as the DisplayNameAttribute does not allow for a localizable value to be assigned to it (unlike some of the other attributes in System.ComponentModel).
Pressing Alt-Enter on the squiggly-underlined 'displayName' parameter results in a context menu containing only 'Split String'.
Please sign in to leave a comment.
Hello Nathan,
DisplayNameAttribute provides a display name for a property that will be
presented to the end-user, so in a localized project the value of this attribute
should be localized as well. There's no built-in quick-fix for 'Localizable
string' warning in this case in ReSharper yet, but you can take a look at
the answers at http://stackoverflow.com/questions/356464/Localization-of-DisplayNameAttribute
that describe how a localizable DisplayName can be created. Thank you!
Andrey Serebryansky
Senior Support Engineer
JetBrains, Inc
http://www.jetbrains.com
"Develop with pleasure!"
Indeed I understand why it would be marked as localizable, but my point was that it should not be because it cannot be localized without first extending the DisplayNameAttributeClass (as the link your provided examplifies).