diff --git a/src/Components/Components/src/Rendering/ComponentState.cs b/src/Components/Components/src/Rendering/ComponentState.cs index b628983ab75f..de620ccf8ffe 100644 --- a/src/Components/Components/src/Rendering/ComponentState.cs +++ b/src/Components/Components/src/Rendering/ComponentState.cs @@ -236,6 +236,9 @@ public Task DisposeInBatchAsync(RenderBatchBuilder batchBuilder) var result = ((IAsyncDisposable)Component).DisposeAsync(); if (result.IsCompletedSuccessfully) { + // If it's a IValueTaskSource backed ValueTask, + // inform it its result has been read so it can reset + result.GetAwaiter().GetResult(); return Task.CompletedTask; } else diff --git a/src/Servers/Kestrel/Core/src/Internal/Http2/Http2Stream.cs b/src/Servers/Kestrel/Core/src/Internal/Http2/Http2Stream.cs index a9b8036932a5..ffe6ab76e98d 100644 --- a/src/Servers/Kestrel/Core/src/Internal/Http2/Http2Stream.cs +++ b/src/Servers/Kestrel/Core/src/Internal/Http2/Http2Stream.cs @@ -450,6 +450,10 @@ public Task OnDataAsync(Http2Frame dataFrame, in ReadOnlySequence payload) // It shouldn't be possible for the RequestBodyPipe to fill up an return an incomplete task if // _inputFlowControl.Advance() didn't throw. Debug.Assert(flushTask.IsCompletedSuccessfully); + + // If it's a IValueTaskSource backed ValueTask, + // inform it its result has been read so it can reset + flushTask.GetAwaiter().GetResult(); } } }