Skip to content

JsonSerializer no longer passes the CancellationToken to the AsyncEnumerable #79556

@Tratcher

Description

@Tratcher

Description

This commit refactored the JsonSerializer:
3559d33#diff-65021de09c4fb9b39607f1f3ed228e53cd04b483880f66b0ea56310f71a5e400L320

However, now state.CancellationToken doesn't get set anymore. This is failing tests in AspNetCore
https://dev.azure.com/dnceng-public/public/_build/results?buildId=109479&view=ms.vss-test-web.build-test-results-tab&runId=2337376&resultId=105425&paneView=debug

WriteStack state = default;
state.Initialize(this,
rootValueBoxed,
isInvokedByPolymorphicConverter,
supportContinuation: true,
supportAsync: true);

Reproduction Steps

The test cancels the token as soon as the async enumeration starts, but the token is not passed through to the IAsyncEnumerable.
https://github.com/dotnet/aspnetcore/blob/6956f42a0a01ed4fb8fc2cb889c2535f8fe5f735/src/Http/Http.Extensions/test/HttpResponseJsonExtensionsTests.cs#L360-L369

Expected behavior

The cancellation token should be passed through to the enumerator.

Actual behavior

The cancellation token is not passed through to the enumerator.

Regression?

Yes, 7 days ago.
3559d33#r92837773

Known Workarounds

No response

Configuration

8.0.0-alpha.1.22611.2
https://github.com/dotnet/aspnetcore/pull/45475/files#diff-1ea18ff65faa2ae6fed570b83747086d0317f5e4bc325064f6c14319a9c4ff67R122

Other information

No response

Metadata

Metadata

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions