Skip to content

Conversation

@Youssef1313
Copy link
Member

@Youssef1313 Youssef1313 commented Jan 15, 2026

The test that was added in #7192 along with the implementation is flaky. This should fix it.

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR fixes a race condition in the SingleThreadedSTASynchronizationContext class where the BlockingCollection could be disposed while the background thread was still consuming from it. The fix introduces a ManualResetEventSlim to ensure the thread completes before disposing the queue.

Changes:

  • Added thread synchronization using ManualResetEventSlim to ensure safe disposal
  • Modified the Dispose method to wait for thread completion before disposing resources
  • Added explanatory comments documenting the disposal flow

Copy link
Contributor

Copilot AI commented Jan 15, 2026

@Youssef1313 I've opened a new pull request, #7231, to work on those changes. Once the pull request is ready, I'll request review from you.

@Youssef1313 Youssef1313 merged commit 55e3748 into main Jan 15, 2026
10 checks passed
@Youssef1313 Youssef1313 deleted the dev/ygerges/stabilize-sta branch January 15, 2026 12:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants