Skip to content

Support using any dictionary as JsonExtensionData #31645

@kostrse

Description

@kostrse

IMHO, IReadOnlyDictionary should work identical to IDictionary when using with JsonExtensionData attribute.

[JsonExtensionData]
public IReadOnlyDictionary<string, JsonElement> Payload { get; set; }

Currently it fails with error:

System.InvalidOperationException: The data extension property 'Payload' does not match the required signature of IDictionary<string, JsonElement> or IDictionary<string, object>.

This is analogous to collection properties which can be defined as List<T>, IList<T> or IReadOnlyList<T> etc.

Metadata

Metadata

Assignees

Labels

area-System.Text.JsonenhancementProduct code improvement that does NOT require public API changes/additionshelp wanted[up-for-grabs] Good issue for external contributorsin-prThere is an active PR which will close this issue when it is mergedwishlistIssue we would like to prioritize, but we can't commit we will get to it yet

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions