Remove JsonSerializerOptions copy in ProblemDetailsJsonOptionsSetup#46716
Merged
Conversation
brunolins16
added a commit
to brunolins16/aspnetcore
that referenced
this pull request
Feb 16, 2023
davidfowl
reviewed
Feb 16, 2023
| break; | ||
| case not null: | ||
| // Combine the current resolver with our internal problem details context (adding last) | ||
| options.SerializerOptions.AddContext<ProblemDetailsJsonContext>(); |
Member
There was a problem hiding this comment.
This is broken when someone calls AddContext before us right? So it'll be:
custom context -> default context -> problem details context
Member
Author
There was a problem hiding this comment.
You mean because of https://github.com/brunolins16/aspnetcore/blob/9bb6ab75a30e65e4c530d647a7798c1a96b3e92e/src/Http/Http.Extensions/src/JsonOptions.cs#L37, right? If so, it will actually be:
default context -> custom context -> problem details context
Unless someone called the Combine api, JsonTypeInfoResolver.Combine(MyCustomContext.Default, options.SerializerOptions.TypeInfoResolver);, to prepend instead of append
This is kind of the issue we are discussing with S.T.J team and I am trying to fix here #46490
…xtensionsTest.cs Co-authored-by: Brennan <brecon@microsoft.com>
Member
Author
|
/azp run |
|
Azure Pipelines successfully started running 3 pipeline(s). |
captainsafia
approved these changes
Mar 1, 2023
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #46143