Skip to content

fix(vs): Marshal dispose to the UI thread (backport #24321) - #25761

Merged
agneszitte merged 1 commit into
release/stable/6.7from
mergify/bp/release/stable/6.7/pr-24321
Oct 27, 2026
Merged

agneszitte merged 1 commit into
release/stable/6.7from
mergify/bp/release/stable/6.7/pr-24321

Conversation

@mergify

@mergify mergify Bot commented Oct 27, 2026

Copy link
Copy Markdown
Contributor

GitHub Issue: closes #24149

PR Type:

🐞 Bugfix

What changed? 🚀

Uno.UI.RemoteControl.VS.EntryPoint can be disposed from any thread — for example, the Studio VSIX (DevServerLauncher) disposes the reflection-loaded entry point from a thread-pool task while the solution is closing. The teardown, however, touches UI-thread-affine COM objects (DTE BuildEvents unsubscription, IVsInfoBar* cleanup, menu command disposal), which throws COMException when invoked off the UI thread.

Because Dispose wraps the teardown in a try/catch and _isDisposed is set up-front, the exception was swallowed and the teardown was silently aborted partway through: _unoMenuCommand, _appLaunchIdeBridge, and _appLaunchStateConsumer leaked, and open InfoBars were never removed.

This PR marshals the teardown to the UI thread:

  • EntryPoint.Dispose now takes a ThreadHelper.CheckAccess() fast path when already on the UI thread, and otherwise runs the teardown via ThreadHelper.JoinableTaskFactory.Run + SwitchToMainThreadAsync. The teardown body is extracted into DisposeCore, which keeps ThrowIfNotOnUIThread as a guard. Marshaling once at the EntryPoint level covers all child disposables.
  • InfoBarFactory.Dispose gets the same treatment (it is also reachable independently), replacing its former ThrowIfNotOnUIThread hard requirement.

PR Checklist ✅

  • 🧪 Added Runtime tests, UI tests, or a manual test sample (for bug fixes / features, if applicable) — not applicable: VS extension teardown path; validation requires a devenv + VSIX debugging session (manual verification with the reporter's scenario).
  • 📚 Docs have been added/updated following the documentation template (for bug fixes / features) — not applicable, no user-facing behavior change.
  • 🖼️ Validated PR Screenshots Compare Test Run results — not applicable, VS tooling only.
  • ❗ Contains NO breaking changes
  • 👀 Reviewed 2 other open pull requests (optional but appreciated!)

This is an automatic backport of pull request #24321 done by [Mergify](https://mergify.com).

@mergify mergify Bot mentioned this pull request Oct 27, 2026
1 of 5 tasks
@agneszitte
agneszitte merged commit edbb5f3 into release/stable/6.7 Oct 27, 2026
11 of 12 checks passed
@agneszitte
agneszitte deleted the mergify/bp/release/stable/6.7/pr-24321 branch October 27, 2026 23:25
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.

2 participants