inappropriate warning on badly formed attributes

Hi,

I was reluctant to report this as a bug as I haven't searched jira that thoroughly so I thought I'd just post here.

I tried cut and pasting this  first snippet of code taken from http://www.csharpconsultant.net/post/2009/01/07/The-Very-Basics-of-a-Custom-ConfigurationSection.aspx into visual studio 2008 with resharper 4.5.1231.7:

public class NotificationsConfigurationSection : ConfigurationSection
{
  private const string configPath = "cSharpConsultant/notifications";
  public static NotificationsConfigurationSection GetSection()
  {
    return (NotificationsConfigurationSection)
      ConfigurationManager.GetSection(configPath);
  }
  /*This regular expression only accepts a valid email address. */
  [RegexStringValidator(@"[\w._%+-]+@[\w.-]+\.\w{2,4}")]
  /*Here, we register our configuration property with an attribute.
   Note that the default value is required if we use
   the property validation attributes, which will unfortunately
   attempt to validate the initial blank value if a default isn't found*/

  [ConfigurationProperty("emailAddress", DefaultValue=Address@Domain.com)]
  public string EmailAddress
  {
    get{ return (string)this["emailAddress"]; }
    set{ this["emailAddress"] = value; }
  }
}


This seems to be invalid due to the '@' in DefaultValue=Address@Domain.com, inasmuch as the compiler dislikes it.

Resharper immediatelly highlights both attributes as invalid for this declaration type. While there is an error, this warning does not seem to be the most appropriate.

Removing the '@' or enquoting appropriatelly removes the warning.

Please sign in to leave a comment.