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'.

2 comments
Comment actions Permalink

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!"

This is only a minor bug, but a bug all the same. ReSharper
5.1.1752.41 adds an inspection error to the
http://msdn.microsoft.com/en-us/library/bk6fxa98.aspx constructor's
'displayName' parameter reading 'Localizable string: '. 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'.

---
Original message URL:
http://devnet.jetbrains.net/message/5275486#5275486



0
Comment actions Permalink

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).

0

Please sign in to leave a comment.