Skip to content

[WIP] Fix IReadOnlyDictionary treated as array-like on serialization#2285

Closed
Copilot wants to merge 1 commit intomainfrom
copilot/fix-issue-with-ireadonlydictionary
Closed

[WIP] Fix IReadOnlyDictionary treated as array-like on serialization#2285
Copilot wants to merge 1 commit intomainfrom
copilot/fix-issue-with-ireadonlydictionary

Conversation

Copy link
Contributor

Copilot AI commented Feb 15, 2026

Thanks for assigning this issue to me. I'm starting to work on it and will keep this PR's description up to date as I form a plan and make progress.

Original prompt

This section details on the original issue you should resolve

<issue_title>IReadOnlyDictionary is treated as array-like</issue_title>
<issue_description>

Discussed in #2206

Originally posted by SebastianStehle December 5, 2025

I am not sure yet, if this is a bug. I have a custom IReadOnlyDictionary that gets treated as array like. Therefore it will also be serialized as array when I use toJSON.

I think the culprit is here:

isDictionary = typeof(IDictionary).IsAssignableFrom(type);

Is there something I can do to prevent that?

<agent_instructions>read the discussion and find optimal solution, create test coverage to show the problem, then fix fit</agent_instructions>

Comments on the Issue (you are @copilot in this section)


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

@lahma
Copy link
Collaborator

lahma commented Feb 15, 2026

@copilot continue

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

IReadOnlyDictionary is treated as array-like

2 participants