title: IgnoreDataMember doesn't work, but JsonIgnore does
body: <p>I'm encountering an odd situation where <code>IgnoreDataMember</code> isn't doing the job, but <code>JsonIgnore</code> does.</p>
  
  <p>In this case I'm inheriting from a class with a <code>public {get; set;}</code> property, and I'm choosing to override the setter with a <code>NotSupportedException</code>. I only want the serializer to be able to set the property, not the user, but I want the user to get it, so I've done the following:</p>
  
  <pre><code>[DataContract]
  public class BaseObject : BaseInterface
  {
       [DataMember]
       public virtual double information { get; set; }
  }
  
  [DataContract]
  public class ServerGeneratedObject : BaseObject
  {
       [IgnoreDataMember]
       public override double information {
           get { return server_set_information; }
           set { throw new NotSupportedException("Server generated property"); }
       }
  
       [DataMember(Name="information")]
       private double server_set_information { get; set; }
  }
  </code></pre>
  
  <p>Unfortunately, this raises an error "A member with the name 'information' already exists on 'ServerGeneratedObject'. Use the JsonPropertyAttribute to specify another name."</p>
  
  <p>If, however, I use the [JsonIgnore] attribute, this works as expected. This appears to be due to this section of the data contract resolver (<a href="https://github.com/JamesNK/Newtonsoft.Json/blob/master/Src/Newtonsoft.Json/Serialization/DefaultContractResolver.cs#L1495" rel="noreferrer">code currently lives here</a>):</p>
  
  <pre><code>bool flag2 = JsonTypeReflector.GetAttribute&lt;JsonIgnoreAttribute&gt;(attributeProvider) != null ||
      JsonTypeReflector.GetAttribute&lt;JsonExtensionDataAttribute&gt;(attributeProvider) != null ||
      JsonTypeReflector.GetAttribute&lt;NonSerializedAttribute&gt;(attributeProvider) != null;
  if (memberSerialization != MemberSerialization.OptIn)
  {
      bool flag3 = JsonTypeReflector.GetAttribute&lt;IgnoreDataMemberAttribute&gt;(attributeProvider) != null;
      property.Ignored = flag2 | flag3;
  }
  </code></pre>
  
  <p>The property isn't correctly being set to 'ignored' because it's in 'OptIn' mode, but if that's the case, I have no idea why the inherited "information" property is being "opted in" because the "DataMember" attribute is not supposed to be inheritable. I filed a bug <a href="https://github.com/JamesNK/Newtonsoft.Json/issues/943" rel="noreferrer">here</a> in case this isn't expected behaviour.</p>
  
  <p>Is there something I can do here? I'm trying to avoid using any "Newtonsoft" attributes on my public data model, because I don't want people using my client library object model to necessarily have to reference the Newtonsoft assembly.</p>