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

[release/8.0] Update HttpClientJsonExtensions.Get.AsyncEnumerable.cs #92199

Merged
merged 8 commits into from
Sep 18, 2023

Conversation

github-actions[bot]
Copy link
Contributor

@github-actions github-actions bot commented Sep 17, 2023

Backport of #92180 to release/8.0

/cc @eiriktsarpalis @WeihanLi

Customer Impact

We received a customer reported issue that one of the newly added IAsyncEnumerable methods in the System.Net.Http.Json library is not using the correct default settings when deserializing values.

For instance, even though all other methods in the library use camelCase conversion, the impacted new methods do not.

Testing

Added unit testing covering the impacted scenario.

Risk

Low. Makes a minor change in product code making it consistent with other components in the same library (including other IAsyncEnumerable methods added in the same change).

@ghost
Copy link

ghost commented Sep 17, 2023

Tagging subscribers to this area: @dotnet/ncl
See info in area-owners.md if you want to be subscribed.

Issue Details

Backport of #92180 to release/8.0

/cc @eiriktsarpalis @WeihanLi

Customer Impact

Testing

Risk

IMPORTANT: If this backport is for a servicing release, please verify that:

  • The PR target branch is release/X.0-staging, not release/X.0.

  • If the change touches code that ships in a NuGet package, you have added the necessary package authoring and gotten it explicitly reviewed.

Author: github-actions[bot]
Assignees: -
Labels:

area-System.Net

Milestone: -

@eiriktsarpalis eiriktsarpalis self-assigned this Sep 17, 2023
@eiriktsarpalis eiriktsarpalis added this to the 8.0.0 milestone Sep 17, 2023
@eiriktsarpalis eiriktsarpalis requested review from MihaZupan, a team and artl93 September 17, 2023 23:10
@eiriktsarpalis eiriktsarpalis added the Servicing-consider Issue for next servicing release review label Sep 17, 2023
@WeihanLi
Copy link
Contributor

WeihanLi commented Sep 18, 2023

Hi @eiriktsarpalis , just to mention, this also fixes the bug when trying to use a custom serializer option

sample code to reproduce

using var httpClient = new HttpClient();
httpClient.BaseAddress = new Uri("http://localhost:5297");
var stream = httpClient.GetFromJsonAsAsyncEnumerable<Job>("api/Jobs", 
    new JsonSerializerOptions(JsonSerializerDefaults.Web)
);

Exception likes below:

System.InvalidOperationException: JsonSerializerOptions instance must specify a TypeInfoResolver setting before being marked as read-only.
   at System.Text.Json.ThrowHelper.ThrowInvalidOperationException_JsonSerializerOptionsNoTypeInfoResolverSpecified()
   at System.Text.Json.JsonSerializerOptions.MakeReadOnly()
   at System.Net.Http.Json.HttpClientJsonExtensions.FromJsonStreamAsyncCore[TValue](HttpClient client, Uri requestUri, JsonSerializerOptions options, CancellationToken cancellationToken)

@ghost
Copy link

ghost commented Sep 18, 2023

Tagging subscribers to this area: @dotnet/area-system-text-json, @gregsdennis
See info in area-owners.md if you want to be subscribed.

Issue Details

Backport of #92180 to release/8.0

/cc @eiriktsarpalis @WeihanLi

Customer Impact

We received a customer reported issue that one of the newly added IAsyncEnumerable methods in the System.Net.Http.Json library is not using the correct default settings when deserializing values.

For instance, even though all other methods in the library use camelCase conversion, the impacted new methods do not.

Testing

Added unit testing covering the impacted scenario.

Risk

Low. Makes a minor change in product code making it consistent with other components in the same library (including other IAsyncEnumerable methods added in the same change).

Author: github-actions[bot]
Assignees: eiriktsarpalis
Labels:

Servicing-consider, area-System.Text.Json

Milestone: 8.0.0

Copy link
Member

@jeffhandley jeffhandley left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This has my support for RC2, @artl93. It's a broken/imcomplete 8.0 scenario reported by a customer.

Copy link
Contributor

@artl93 artl93 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

M2 approved.

@artl93 artl93 added Servicing-approved Approved for servicing release and removed Servicing-consider Issue for next servicing release review labels Sep 18, 2023
@carlossanlop carlossanlop merged commit e00e6aa into release/8.0 Sep 18, 2023
104 of 108 checks passed
@carlossanlop carlossanlop deleted the backport/pr-92180-to-release/8.0 branch September 18, 2023 23:54
@radical radical mentioned this pull request Sep 26, 2023
@ghost ghost locked as resolved and limited conversation to collaborators Oct 19, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area-System.Text.Json Servicing-approved Approved for servicing release
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants