Skip to content

Conversation

@jasonmalinowski
Copy link
Member

This PR cleans up the final offenders so our package initialization for the C# package and the shared RoslynPackage do not transition to the UI thread anywhere. There are still UI thread transitions in the OnAfterPackageLoad, where we register event handlers for commands and object browser interfaces. VB is also still marked as not supporting background load to a COM marshalling issue to work around some legacy code.

At this point this somewhat moots the PackageLoadTasks infrastructure, but a follow-up will be made to this PR to remove that since that'll require some coordination and testing further.

@jasonmalinowski jasonmalinowski self-assigned this Dec 18, 2025
@jasonmalinowski jasonmalinowski requested a review from a team as a code owner December 18, 2025 21:33
This removes the eager creation on the UI thread. To maintain
compatibility with F# that accesses this on the UI thread, we'll fetch
it on-demand in that case.
We had some code scheduling to the UI thread to wait for the UI context
to be complete, but that's no longer necessary. Since we also had
multiple derived types all setting this up, but all of them had the
pattern in one way or another, this also just unifies the pattern
to just one case.
This trick means we don't have to switch to the UI thread to call
LoadPackage, but can stay on the background thread the whole time.
@jasonmalinowski jasonmalinowski force-pushed the move-package-initialization-off-the-ui-thread-entirely branch from 15c32c5 to da2514a Compare January 6, 2026 01:28
@jasonmalinowski jasonmalinowski merged commit 3dcfad9 into dotnet:main Jan 8, 2026
26 checks passed
@jasonmalinowski jasonmalinowski deleted the move-package-initialization-off-the-ui-thread-entirely branch January 8, 2026 21:04
@dotnet-policy-service dotnet-policy-service bot added this to the Next milestone Jan 8, 2026
@davidwengier davidwengier modified the milestones: Next, 18.4 Jan 27, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants