Skip to content

Do not flag for CA1056 on members decorated as [DataMember] #4935

Open

Description

Analyzer

Diagnostic ID: CA1056

Describe the improvement

Do not flag for CA1056 on members decorated as [DataMember]

Describe suggestions on how to achieve the rule

Some rules, including CA2227', will not flag on members decorated with the [DataMember] attribute. I'd suggest that CA1056 also gain this exclusion, so not to require suppression when building classes that are purely used for data transfer objects.

Additional context

For example, the JSON Data Contracts for the Bing Maps API has:

    public class ImageryMetadata : Resource  
    {  
        /* omitted for brevity */ 
  
        [DataMember(Name = "imageUrl", EmitDefaultValue = false)]  
        public string ImageUrl { get; set; } // This flags with CA1056  
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions