Skip to content

Remove JsonSerializerOptions copy in ProblemDetailsJsonOptionsSetup #46143

Closed
@brunolins16

Description

@brunolins16

Is there an existing issue for this?

  • I have searched the existing issues

Is your feature request related to a problem? Please describe the problem.

JsonSerializerOptions.AddContext won't make the options read-only anymore (dotnet/runtime#80527) and the following code must be updated to add context to combine with the current one.

if (options.SerializerOptions.IsReadOnly)
{
options.SerializerOptions = new(options.SerializerOptions);
}
// Combine the current resolver with our internal problem details context
options.SerializerOptions.TypeInfoResolver = JsonTypeInfoResolver.Combine(options.SerializerOptions.TypeInfoResolver!, ProblemDetailsJsonContext.Default);

Metadata

Metadata

Assignees

Labels

old-area-web-frameworks-do-not-use*DEPRECATED* This label is deprecated in favor of the area-mvc and area-minimal labels

Type

No type

Projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions