Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Changing to use the non-generic WriteAsJsonAsync #43960

Merged
merged 4 commits into from
Sep 15, 2022

Conversation

brunolins16
Copy link
Member

@brunolins16 brunolins16 commented Sep 13, 2022

Fixes #43894

Description

After changes in how the S.T.J, incorporated in RC1, we are no longer able to use JSON source generators with Minimal APIs without adding [JsonSerializable(typeof(object))] to the configured JsonSerializerContext.

dotnet/docs#30755
dotnet/docs#30758

It is happening because we were calling HttpResponseJsonExtensions.WriteAsJsonAsync<object?> to keep the polymorphic behavior reported here #41724 (comment).

In this change we are using the non-generic HttpResponseJsonExtensions.WriteAsJsonAsync method and providing the runtime type to the JSON Serializer.

Customer Impact

There is no functional impact compared with what we have behavior the S.T.J changes other than make it works with JSON Source Generators.

Regression?

  • Yes
  • No

It is a bug, the polymorphism behavior will be kept but now Minimal will works with JSON Source Generators .

Risk

  • High
  • Medium
  • Low

Verification

  • Manual (required)
  • Automated

Packaging changes reviewed?

  • Yes
  • No
  • N/A

cc @eiriktsarpalis @dotnet/area-system-text-json

@ghost ghost added the area-runtime label Sep 13, 2022
@brunolins16 brunolins16 added area-web-frameworks *DEPRECATED* This label is deprecated in favor of the area-mvc and area-minimal labels and removed area-runtime labels Sep 13, 2022
@brunolins16 brunolins16 marked this pull request as ready for review September 14, 2022 18:34
@brunolins16 brunolins16 requested a review from a team September 14, 2022 18:34
@Pilchie
Copy link
Member

Pilchie commented Sep 15, 2022

Approved for .NET 7 RC2 (pending CI passing).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-web-frameworks *DEPRECATED* This label is deprecated in favor of the area-mvc and area-minimal labels
Projects
None yet
4 participants