Uh oh!
There was an error while loading. Please reload this page.
Fix System.Text.Json IAsyncEnumerator disposal on cancellation - #57505
Conversation
…Disposable instances are disposed exactly once. Fixesdotnet#57360.
ghost
commented
Aug 16, 2021
Tagging subscribers to this area: @eiriktsarpalis, @layomia Issue DetailsAddresses an issue in System.Text.Json IAsyncEnumerable serialization where, in the event of a user-thrown exception, the serializer will attempt to dispose the IAsyncEnumerator instance without making sure that there are no pending This PR changes the IAsyncEnumerable implementation to wait on any pending Fix #57360. cc @davidfowl
|
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
…llectionTests.AsyncEnumerable.cs
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
eiriktsarpalis
commented
Aug 17, 2021
/azp run runtime-libraries outerloop |
|
No pipelines are associated with this pull request. |
eiriktsarpalis
commented
Aug 17, 2021
/azp list |
eiriktsarpalis
commented
Aug 17, 2021
/azp run runtime-libraries-coreclr outerloop |
|
Azure Pipelines successfully started running 1 pipeline(s). |
Addresses an issue in System.Text.Json IAsyncEnumerable serialization where, in the event of a user-thrown exception, the serializer will attempt to dispose the IAsyncEnumerator instance without making sure that there are no pending
MoveNextAsync()operations. In the case of compiler-generated IAsyncEnumerables, this can result in aNotSupportedExceptionbeing thrown, see #51176. This issue will most typically manifest in cases where the ambient cancellation token has fired, but authors of the serialized IAsyncEnumerable are not passing that cancellation token to nested async operations.This PR changes the IAsyncEnumerable implementation to wait on any pending
MoveNextAsync()operations even if an exception has been thrown. This should not have any impact on latency provided that users take care to pass the IAsyncEnumerator cancellation token to any underlying dependencies. It also fixes an unrelated issue where in certain exceptional conditions the serializer would try to dispose the IAsyncEnumerator twice.Fix#57360.
cc @davidfowl