Fix dead code: !completedTask.IsCompleted always false in hedge timer loop#5625
Closed
Copilot wants to merge 9 commits into
Closed
Fix dead code: !completedTask.IsCompleted always false in hedge timer loop#5625Copilot wants to merge 9 commits into
!completedTask.IsCompleted always false in hedge timer loop#5625Copilot wants to merge 9 commits into
Conversation
…gy NullRef fix Adds 8 regression tests covering: - Hedge CTS token cancels in-flight requests (not app CT) - Sender receives hedge CTS token, not application token - App cancellation prevents spawning new hedge requests (do/while fix) - Request not accessed after disposal on cancellation - Stream-based request path (ReadItemStreamAsync) - Primary request fast return skips hedging - All-transient error handling - Concurrent hedging stress test (50 parallel requests)
…edge timer loop Co-authored-by: kundadebdatta <87335885+kundadebdatta@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Fix race condition in CrossRegionHedgingAvailabilityStrategy
Fix dead code: Feb 19, 2026
!completedTask.IsCompleted always false in hedge timer loop
Base automatically changed from
users/fabianm/NullRefInvestigation
to
master
February 20, 2026 21:44
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.
Task.WhenAnyalways returns a task already in a terminal state, socompletedTask.IsCompletedis invariablytrue— making!completedTask.IsCompleteddead code that never triggered. The intended behavior (skip spawning new hedge requests when the timer ended abnormally) was silently broken.Change
!completedTask.IsCompletedwithcompletedTask.IsFaulted || completedTask.IsCanceledto correctly detect abnormal timer completion (cancelled via linked CTS on e2e timeout, or faulted)IsCompletedSuccessfullywas not used — unavailable onnetstandard2.0💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.