Repository navigation
Conversation
…e circuit breaker's scheduled task loop ScheduledTaskExecutor's constructor started its processing loop with Task.Run, which captured the creator's ExecutionContext. The loop lives as long as the pipeline, so the first caller's AsyncLocal values were never collected. Wrap the Task.Run in ExecutionContext.SuppressFlow(). Upstream: App-vNext/Polly#3284 (fixes App-vNext/Polly#3275). Refs #66 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01U6RM4Rd2HejEcaWDY3qovL
iancooper
requested review from
DevJonny,
holytshirt and
preardon
as code owners
October 25, 2026 14:58
This branch has not been deployed
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.
Port of App-vNext/Polly@813d10a6 (App-vNext/Polly#3284, which fixes App-vNext/Polly#3275). Upstream sync #3, tracked in #66.
Problem
ScheduledTaskExecutor's constructor starts its processing loop withTask.Run, which flows the creator'sExecutionContextinto a loop that lives as long as the circuit breaker. The first caller'sAsyncLocalvalues are therefore never collected. Pipelines held in a registry, such as those used byMicrosoft.Extensions.Http.Resilience, live for the whole app, so ambient state such as a Blazor Server circuit leaks.Change
ScheduledTaskExecutor's constructor wraps theTask.Runinusing (ExecutionContext.SuppressFlow()), matching upstream line for line, comment included.Constructor_AmbientExecutionContext_IsNotCaptured(renamed toMember_Scenario_Outcome, with Arrange/Act/Assert comments added).The test failed before the fix (
reference.IsAlive should be False but was True) and passes after it.Verification
Paramore.Fences.Core.Tests: 782/782 pass in Release on net10.0, net9.0 and net8.0.Paramore.Fences.Corebuilds analyser-clean for all TFMs.ScheduledTaskExecutoris internal). No dependency changes.Refs #66
🤖 Generated with Claude Code
https://claude.ai/code/session_01U6RM4Rd2HejEcaWDY3qovL