Skip to content

[S.T.J] JsonProperty unused private field #113643

Closed
@dannyd89

Description

@dannyd89

I'm not 100% sure if this is the right call of me, but during my investigation of the memory usage of my solution I saw JsonProperty allocating for each Name call.

I was using this property of JsonProperty some times in a JsonConverter<T> and taking a look at it

public string Name => _name ?? Value.GetPropertyName();

I recognized _name is never properly set, so I think it should be removed completely from JsonProperty and maybe add a hint that Name allocates for each call? Also the WriteTo could be cleaned up.

If this is correct I would be happy to contribute a PR for this.

Metadata

Metadata

Assignees

No one assigned

    Labels

    area-System.Text.JsonenhancementProduct code improvement that does NOT require public API changes/additionsin-prThere is an active PR which will close this issue when it is merged

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions