Skip to content

Conversation

@ToddGrun
Copy link
Contributor

  1. Move the very expensive color schema applier initialization code to occur after package load. I talked with Joey about this and he indicated this could (quite infrequently) cause a recolorization in the editor upon open, but only when the user had previously changed themes or the very first open of a C# file after install.

  2. Move the global notification service construction to happen on a bg thread, bright before it's use.

  3. Move the SolutionEventMonitor construction and bulk file notification registration to occur after solution load. The bulk notification for the solution open would have already been initiated if the package load occurs during solution load, so this shouldn't affect that notification.

  4. A bit of cleanup from earlier PRs: (VB lambda param cleanup, removing duplicated MiscellaneousFilesWorkspace service retrieval)

…kage

1) Move the *very expensive* color schema applier initialization code to occur after package load. I talked with Joey about this and he indicated this could (quite infrequently) cause a recolorization in the editor upon open, but only when the user had previously changed themes or the very first open of a C# file after install.

2) Move the global notification service construction to happen on a bg thread, bright before it's use.

3) Move the SolutionEventMonitor construction and bulk file notification registration to occur after solution load. The bulk notification for the solution open would have already been initiated if the package load occurs during solution load, so this shouldn't affect that notification.

4) A bit of cleanup from earlier PRs: (VB lambda param cleanup, removing duplicated MiscellaneousFilesWorkspace service retrieval)
@ToddGrun ToddGrun requested a review from a team as a code owner March 21, 2025 21:20
@ghost ghost added Area-IDE untriaged Issues and PRs which have not yet been triaged by a lead labels Mar 21, 2025
var settingsEditorFactory = this.ComponentModel.GetService<SettingsEditorFactory>();

packageInitializationTasks.AddTask(
isMainThreadTask: true,
Copy link
Member

Choose a reason for hiding this comment

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

so, this goes to my feedback from before. why are we initializing on the BG just to kick this tack over to the foreground? why not just do this on the FG?

(note: i'm not saying this is wrong. i'm just saying i don't understand the 'why?' part fo this, and i really wish the code was doc'ed for future understanding).

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This one is done because SettingsEditorFactory is fairly expensive to create, thus wanting it done on a bg thread and the main thread work depends on that being initialized. I'll create a follow up PR to make that ctor less expensive so it's not a big deal to create it on the main thread.

Copy link
Member

Choose a reason for hiding this comment

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

I think in this specific case, SettingsEditorFactory is fairly expensive to create via MEF. There's a more general piece of work to clean that up since really should be cheap to create and pass to RegsiterEditorFactory, but that's not how it's written right now.

Copy link
Member

Choose a reason for hiding this comment

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

my ask is that we then doc these decisions in the code. :)

Assumes.Present(globalNotificationService);

_solutionEventMonitor = new SolutionEventMonitor(globalNotificationService);
TrackBulkFileOperations(globalNotificationService);
Copy link
Member

Choose a reason for hiding this comment

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

consider inlining this. it's more confusing to me as a call out to a function.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think I'd prefer to keep that method separate. It's fairly long and has two local functions inside it already.


// We are at the VS layer, so we know we must be able to get the IGlobalOperationNotificationService here.
var globalNotificationService = this.ComponentModel.GetService<IGlobalOperationNotificationService>();
Assumes.Present(globalNotificationService);
Copy link
Member

Choose a reason for hiding this comment

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

no GetRequiredService or anything like that?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

MEF throws if there isn't exactly one matching export. I'll remove the Assumes.Present as it probably makes that less obvious.

packageInitializationTasks.AddTask(
isMainThreadTask:=False,
task:=Function(packageInitializationTasks2, cancellationToken) As Task
task:=Function() As Task
Copy link
Member

Choose a reason for hiding this comment

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

Oh that's right I forgot VB lets you do this. I figured remove it from the C# side too....

@jasonmalinowski
Copy link
Member

@ToddGrun Help me understand the benefit here -- is the advantage of this going after package load is that other things blocking on package load can continue their work while this all runs?

@ToddGrun
Copy link
Contributor Author

Yes, essentially allowing higher priority items during solution/package load to be less contended. And I guess this helps the case where our packages are loaded but don't need this information right away.


In reply to: 2744576389

@ToddGrun ToddGrun merged commit 8bcbd05 into dotnet:release/dev17.15 Mar 22, 2025
25 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Area-IDE untriaged Issues and PRs which have not yet been triaged by a lead

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants