Repository navigation
fix(vs): Marshal dispose to the UI thread (backport #24321) - #25760
Merged
Merged
Conversation
agneszitte
approved these changes
Oct 27, 2026
1 of 5 tasks
Merged
1 task done
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.
GitHub Issue: closes #24149
PR Type:
🐞 Bugfix
What changed? 🚀
Uno.UI.RemoteControl.VS.EntryPointcan 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 (DTEBuildEventsunsubscription,IVsInfoBar*cleanup, menu command disposal), which throwsCOMExceptionwhen invoked off the UI thread.Because
Disposewraps the teardown in atry/catchand_isDisposedis set up-front, the exception was swallowed and the teardown was silently aborted partway through:_unoMenuCommand,_appLaunchIdeBridge, and_appLaunchStateConsumerleaked, and open InfoBars were never removed.This PR marshals the teardown to the UI thread:
EntryPoint.Disposenow takes aThreadHelper.CheckAccess()fast path when already on the UI thread, and otherwise runs the teardown viaThreadHelper.JoinableTaskFactory.Run+SwitchToMainThreadAsync. The teardown body is extracted intoDisposeCore, which keepsThrowIfNotOnUIThreadas a guard. Marshaling once at theEntryPointlevel covers all child disposables.InfoBarFactory.Disposegets the same treatment (it is also reachable independently), replacing its formerThrowIfNotOnUIThreadhard requirement.PR Checklist ✅
Screenshots Compare Test Runresults — not applicable, VS tooling only.This is an automatic backport of pull request #24321 done by [Mergify](https://mergify.com).