Repository navigation
Consume ValueTask result - #3314
Merged
Merged
Conversation
Address GitHub Copilot feedback on #3313.
6 of 7 tasks
There was a problem hiding this comment.
🟢 Approval recommended
No active review issues remain for the ValueTask result-consumption change.
No open issues 🎉
What changed in this PR
This PR follows up on #3313 by consuming successfully completed, non-generic ValueTask results in Polly’s outcome conversion fast path, allowing source-backed tasks to release their resources.
Changes:
- Calls
GetResult()before returning a successful void outcome. - Adds a tracking test helper and regression tests for exactly-once consumption across outcome conversion and pipeline overloads.
- Adds benchmarks for non-generic asynchronous callbacks that complete synchronously.
| File | Description |
|---|---|
test/Polly.Core.Tests/ResiliencePipelineTests.AsyncT.cs |
Tests exactly-once consumption for result-returning pipeline overloads. |
test/Polly.Core.Tests/ResiliencePipelineTests.Async.cs |
Tests exactly-once consumption for void pipeline overloads. |
test/Polly.Core.Tests/OutcomeTests.cs |
Tests consumption during generic and non-generic outcome conversion. |
test/Polly.Core.Tests/Helpers/CompletedValueTaskSource.cs |
Adds a completed task source that counts result consumption. |
src/Polly.Core/Outcome.cs |
Consumes completed void tasks before returning the outcome. |
bench/Polly.Core.Benchmarks/ResiliencePipelineBenchmark.cs |
Adds void callback benchmarks for context/state and cancellation-token overloads. |
Review effort: Balanced
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #3314 +/- ##
=======================================
Coverage 98.04% 98.04%
=======================================
Files 321 321
Lines 7157 7158 +1
Branches 1107 1107
=======================================
+ Hits 7017 7018 +1
Misses 98 98
Partials 42 42
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. |
martincostello
marked this pull request as ready for review
November 7, 2026 15:38
martincostello
enabled auto-merge (squash)
November 7, 2026 15:38
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Address GitHub Copilot feedback on #3313.