Code Quality: Removed the MMI reference for AOT compatibility#18644
Open
0x5bfa wants to merge 4 commits into
Open
Code Quality: Removed the MMI reference for AOT compatibility#186440x5bfa wants to merge 4 commits into
0x5bfa wants to merge 4 commits into
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR removes the legacy Microsoft.Management.Infrastructure (MMI) / WMI-based drive detection code from the WinUI app and replaces it with a CsWin32-backed Shell notification manager to improve AOT compatibility and reduce dependency surface area.
Changes:
- Removed MMI package references and eliminated WMI watcher/helper types that depended on MMI.
- Replaced Win32 drive insertion/ejection monitoring with a new
WindowsDriveManagerusingSHChangeNotifyRegister+ a hidden window WndProc. - Cleaned up About page third-party references accordingly.
Reviewed changes
Copilot reviewed 12 out of 12 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| src/Files.App/ViewModels/Settings/AboutViewModel.cs | Removes the MMI attribution/link from the About page. |
| src/Files.App/Utils/Storage/Helpers/DriveHelpers.cs | Drops the MMI-backed GetVolumeId helper and its import. |
| src/Files.App/Utils/Global/WindowsStorageDeviceWatcher.cs | Switches from DeviceManager to WindowsDriveManager and starts/stops the new manager. |
| src/Files.App/Utils/Storage/Helpers/DeviceManager.cs | Deletes the old WMI/MMI-based device watcher implementation. |
| src/Files.App/Helpers/WMI/WqlEventQuery.cs | Deletes WMI query helper type tied to the old watcher. |
| src/Files.App/Helpers/WMI/ManagementEventWatcher.cs | Deletes MMI-based event watcher implementation. |
| src/Files.App/Data/EventArguments/EventArrivedEventArgs.cs | Deletes event args type used only by the old MMI watcher. |
| src/Files.App/Files.App.csproj | Removes MMI package references from the app project. |
| src/Files.App.Storage/Windows/Managers/WindowsDriveManager.cs | Adds a new Shell notification-based drive manager (CsWin32). |
| src/Files.App.CsWin32/NativeMethods.txt | Adds required Shell APIs/types for the new drive manager. |
| src/Files.App.CsWin32/ManualGuid.cs | Adds FOLDERID_ComputerFolder GUID used to scope Shell notifications. |
| Directory.Packages.props | Removes MMI package versions from central package management. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
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.
Resolved / Related Issues
This project has been abandoned and replaced by
System.Managementbut this is also AOT unsafe. Plus, we no longer have to use this safe code after we migrated to WASDK. I've replaced the MMI references with COM APIs.Steps used to test these changes