Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Hot (un)load extensions on (un)install #375

Merged
merged 7 commits into from
Jan 28, 2025

Conversation

zadjii-msft
Copy link
Owner

@zadjii-msft zadjii-msft commented Jan 28, 2025

Closes #370

The DevHome code was great for "I need something that can lookup extensions and enumerate all of them".

However, the DevHome code is a very blunt hammer when it comes to extensions. The only thing it tracks is "packages changed", and if it gets one of those, it just blows away all the extensions and rebuilds them. Yikes.

This PR changes ExtensionService to be a scalpel. We'll keep _installedExtensions fresh. When we get a package install, we'll add only that package's extension to our cache, and let the TopLevelCommandManager know. Similarly for updates and uninstalls.

That way, we can exactly change the top-level list as needed, rather than bluntly forcing all the extensions to reload.

In the middle of all this, I fixed a bug where uninstalling an extension, then reloading would just fail to load extensions. This is because the old code would clear out the whole list of extensions when one was uninstalled. That created a race where we'd be parsing the new list of all the extensions (from the reload), get an uninstall event, clear the list, then InvalidOperation as the list of extensions was modified during enumeration.

There's a bunch more locking in here. This might drive-by #324 but hard to be sure.

Related to #89

zadjii and others added 7 commits January 27, 2025 15:43
But it's probably overkill. I think I really only need the things in ExtensionService.
The problem was that TopLevelCommandManager iterates over the installed extensions on a reload,
but SIMULTANEOUSLY, the ExtensionService gets the notification that the extension was uninstalled,
and it fuckin blows away the whole _installedExtensions cache
@zadjii-msft zadjii-msft merged commit 0fba556 into main Jan 28, 2025
6 checks passed
@zadjii-msft zadjii-msft deleted the dev/migrie/f/update-extensions-when-installed branch January 28, 2025 19:45
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.

We never hooked up the extension change event
2 participants