Skip to content

Restore early disposal state and bypass cleanup send guard in BaseRendererControl - #400

Merged
MayaKirova merged 3 commits into
mkirova/fix-disposalfrom
copilot/mkirovafix-disposal
Sep 10, 2026
Merged

Restore early disposal state and bypass cleanup send guard in BaseRendererControl#400
MayaKirova merged 3 commits into
mkirova/fix-disposalfrom
copilot/mkirovafix-disposal

Conversation

Copilot AI commented Sep 8, 2026

Copy link
Copy Markdown
Contributor

This follow-up keeps PR #399 focused on cleanup delivery: restore early disposal state publication and send cleanup through a dedicated path that is not blocked by normal disposed-message guards. It preserves existing cleanup delivery/idempotency tests without pulling in the queue/disposal locking work tracked separately in #394.

  • Disposal ordering (reverted to early publication)

    • DisposeAsync now sets disposedValue = true before runtime reevaluation and before awaiting cleanup.
    • Removed the late disposedValue assignment from the finally block.
  • Cleanup send path (dedicated bypass)

    • TrySendCleanupAsync still clears _messageQueue.
    • Cleanup now calls SendJsonImmediate(m) directly instead of SendMessageImmediate(m), so cleanup is delivered even after normal sends are closed by disposal.
  • Intent made explicit

    • Added a concise inline comment clarifying that disposal has already closed normal sends and cleanup intentionally bypasses the disposed guard.
disposedValue = true;
_shouldReevaluateRuntime = true;
await TrySendCleanupAsync().ConfigureAwait(false);

// ...

_messageQueue.Clear();
// Normal sends are already closed by disposal; cleanup intentionally bypasses the disposed guard.
await SendJsonImmediate(m).ConfigureAwait(false);

Co-authored-by: damyanpetev <3198469+damyanpetev@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix cleanup delivery in BaseRendererControl Restore early disposal state and bypass cleanup send guard in BaseRendererControl Sep 8, 2026
Copilot AI requested a review from damyanpetev September 8, 2026 16:34
@damyanpetev
damyanpetev marked this pull request as ready for review September 8, 2026 16:49
@damyanpetev
damyanpetev requested review from MayaKirova and a lite review from Copilot September 8, 2026 16:49

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟢 Approval recommended

The changes are small, consistent with the stated intent, and directly address cleanup delivery after disposal without altering broader queue/locking behavior.

Pull request overview

This PR adjusts BaseRendererControl disposal behavior to ensure the cleanup message is still delivered even after the normal disposed-message guards have closed standard sends, aligning disposal ordering with the intended cleanup-delivery semantics described in PR #394/#399 context.

Changes:

  • Publish disposedValue = true early in DisposeAsync, before reevaluating runtime validity and before awaiting cleanup.
  • Send the cleanup message via SendJsonImmediate (bypassing the disposed guard in SendMessageImmediate) while still clearing the pending message queue.
  • Add an inline comment documenting that cleanup intentionally bypasses the normal disposed send guard.
File summaries
File Description
src/componentsBase/BaseRendererControl.cs Restores early disposal state publication and routes cleanup through a dedicated send path that isn’t blocked by normal disposed-message guards.
Review details
  • Files reviewed: 1/1 changed files
  • Comments generated: 0
  • Review effort level: Lite

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

@damyanpetev
damyanpetev removed this pull request from stack #401 September 9, 2026 13:51
@MayaKirova
MayaKirova merged commit 526d9fa into mkirova/fix-disposal Sep 10, 2026
@MayaKirova
MayaKirova deleted the copilot/mkirovafix-disposal branch September 10, 2026 06:43
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.

4 participants