Skip to content

Patching of readonly collections fails #2427

Closed
@aspnet-hello

Description

@aspnet-hello

From @MovGP0 on Wednesday, October 25, 2017 2:38:39 AM

Given I have an Entity with an readonly collection like this:

public sealed class MyEntity 
{
    public MyEntity()
    {
    }

    [JsonConstructor]
    public MyEntity(IEnumerable<string> tags)
    {
        Tags = tags?.ToList() ?? new List<string>();
    }

    [JsonProperty("tags")]
    public ICollection<string> Tags { get; } = new List<string>();
}

Than it is not possible to patch it, besides the property beeing potentially writeable and also serializeable.

Copied from original issue: aspnet/JsonPatch#118

Metadata

Metadata

Assignees

No one assigned

    Labels

    area-mvcIncludes: MVC, Actions and Controllers, Localization, CORS, most templatesbugThis issue describes a behavior which is not expected - a bug.help wantedUp for grabs. We would accept a PR to help resolve this issue

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions