Skip to content

Conversation

@jasonmalinowski
Copy link
Member

For the csproj and msvbprj project systems, our COM services get called on the UI thread when project information is being sent our way. This has the side effect of creating all our "lazily created" MEF services on that UI thread during that time, which can result in more unnecessary blocking. Changing how those project systems work would be a hugely complicated change, but what we can do is take advantage of the preloading support that exists in VS to ensure we preload what we can off the UI thread before we hit the legacy code.

This isn't doing anything interesting.
uiContext.IsActive = this.CurrentSolution.Projects.Any(p => p.Language == language);
}

internal void PreloadProjectSystemComponents(string languageName)
Copy link
Member Author

Choose a reason for hiding this comment

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

More stuff may be added later here; the goal of this PR is mostly to get this in place so the preloader can be updated to take advantage of it. Once we get that under some perf traces we'll look at what else needs to be added here.

Try
RegisterLanguageService(GetType(IVbCompilerService), Function() Task.FromResult(_comAggregate))
AddService(GetType(IVbCompilerService), Function(_1, cancellationToken, _2)
PreloadProjectSystemComponents()
Copy link
Member Author

Choose a reason for hiding this comment

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

In the VB case, there's an explicit request for the service, so we can just add this without problems.

For the csproj and msvbprj project systems, our COM services get called
on the UI thread when project information is being sent our way. This
has the side effect of creating all our "lazily created" MEF services
on that UI thread during that time, which can result in more unnecessary
blocking. Changing how those project systems work would be a hugely
complicated change, but what we can do is take advantage of the
preloading support that exists in VS to ensure we preload what we can
off the UI thread before we hit the legacy code.
@jasonmalinowski jasonmalinowski force-pushed the create-project-system-preloading-services branch from d3e916a to 95f7368 Compare September 16, 2025 21:25
@jasonmalinowski
Copy link
Member Author

Waiting for an internal validation pass before merging this one.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants