Allow JsonSerializerOptions without TypeInfoResolver
Maintainers usually reply within 2 days
Nobody has claimed this yet.
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 52/100
Research direction
Start at the WithTools implementation mentioned in the issue and trace how the supplied JsonSerializerOptions are made read-only. Reproduce the behavior with a new System.Text.Json.JsonSerializerOptions that only adds converters and a naming policy; done means passing it to WithTools throws no exception.
Written by the indexing model from the issue text.
Description
I have JsonSerializerOptions which only adds some converters and set the naming policy. I don't have a source generated JsonSerializerContext and therefore no TypeInfoResolver.
When passing these options to a WithTools function, I get the exception:
JsonSerializerOptions instance must specify a TypeInfoResolver setting before being marked as read-only.
I understand that making these options read only is a good thing, but I don't understand enough about the difference to the overload of MakeReadOnly(populateMissingResolver) on the options.
I can set TypeInfoResolver = new DefaultJsonTypeInfoResolver() on my options, but that seems a bit weird.
To Reproduce
Steps to reproduce the behavior:
- Pass a
new System.Text.Json.JsonSerializerOptions()object to one of theWithToolsfunctions.
Expected behavior
No exception should be thrown.
- Dominant language
- C#
- Stars
- 4.5k
- Forks
- 814
- Avg merge
- 9d 19h
- Merged PRs (30d)
- 4
Getting set up
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from modelcontextprotocol/csharp-sdk
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
modelcontextprotocol/csharp-sdk#1867 ·
Maintainers usually reply within 2 days
-
Difficulty 1/5 Under an hour Newbie friendliness 88/100
modelcontextprotocol/csharp-sdk#1840 · 1 comment ·
Maintainers usually reply within 2 days
-
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
modelcontextprotocol/csharp-sdk#1836 ·
Maintainers usually reply within 2 days
-
enhancement needs confirmation
Difficulty 2/5 1-3 hours Newbie friendliness 64/100
modelcontextprotocol/csharp-sdk#678 · 1 comment ·
Maintainers usually reply within 2 days
-
enhancement needs confirmation P3 ready for work
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
modelcontextprotocol/csharp-sdk#515 · 6 comments · 3 reactions ·
Maintainers usually reply within 2 days
All issues in modelcontextprotocol/csharp-sdk
Similar issues
-
ci-failure-cause test-failure
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
-
area:frontend bug FE hotspot:css mvp P3
Difficulty 1/5 Under an hour Newbie friendliness 90/100
klasolsson81/jobbliggaren#1856 ·
Maintainers usually reply within 1 day
-
Area: App+Library Build
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
Maintainers usually reply within 1 day
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
Aaronontheweb/freshdesk-cli#148 ·