Conversation
Reviewer's GuideThe tray menu's Open Data Folder action now invokes Explorer through a temporary Shell.Application COM object, allowing the existing Windows shell to handle the request directly and avoiding the previous explorer.exe stub/forwarding path. The COM object is deterministically released, and validation reports an 81.6% median launch-time reduction with successful exact-path behavior and a clean Release build. Sequence diagram for faster Open Data Folder launchsequenceDiagram
actor User
participant Tray as TrayIconManager
participant COM as Shell.Application
participant Explorer as Windows Shell Explorer
User->>Tray: Open Data Folder
Tray->>COM: CreateInstance
Tray->>COM: InvokeMember Explore(LocalDataPath)
COM->>Explorer: Open data folder
Explorer-->>User: Display responsive data-folder window
Tray->>COM: FinalReleaseComObject
File-Level Changes
Assessment against linked issues
Possibly linked issues
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
There was a problem hiding this comment.
Hey - I've found 1 issue
Prompt for AI Agents
Please address the comments from this code review:
## Individual Comments
### Comment 1
<location path="QuickLook/TrayIconManager.cs" line_range="122-145" />
<code_context>
_icon.IsVisible = false;
}
+ private static void OpenDataFolder()
+ {
+ var shellType = Type.GetTypeFromProgID("Shell.Application");
+ if (shellType == null)
+ throw new InvalidOperationException("Shell.Application is unavailable.");
+
+ var shell = Activator.CreateInstance(shellType);
+ if (shell == null)
+ throw new InvalidOperationException("Unable to create Shell.Application.");
+
+ try
+ {
+ shellType.InvokeMember(
+ "Explore",
+ BindingFlags.InvokeMethod,
+ null,
+ shell,
+ [SettingHelper.LocalDataPath]);
+ }
+ finally
+ {
</code_context>
<issue_to_address>
**issue (broader_impact):** When Shell.Application is unregistered, blocked by COM policy, or its Explore call fails, the tray command throws and no folder is opened because the new implementation has no fallback to the previous explorer.exe launch.
**Triggers:** When COM activation or the Shell.Application Explore invocation fails on a machine where explorer.exe itself is still available.
**Suggested fix:** Catch COM activation/invocation failures and fall back to `Process.Start("explorer.exe", SettingHelper.LocalDataPath)` instead of propagating the exception to the UI error handler.
</issue_to_address>Sourcery assessment
Approval pending. 1 finding to address first.
Blocking findings: QuickLook/TrayIconManager.cs:145
Member
|
According to AI analysis, my solution is more compatible and stable: |
Author
|
@emako Inspired by your approach. Now it's simpler with same perf benefit. |
This branch has not been deployed
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.
PR Checklist
Brief Description of Changes
Open Data Folder now asks the Windows shell to open the data folder
directly instead of explicitly starting
explorer.exe:This is the same shell
openrequest asShellExecuteW(..., "open", folder, ...),following the reviewer's suggestion. The previous implementation started a
temporary Explorer stub process that forwarded the request to a separate
Explorer factory process. With the shell
openrequest, the already-runningExplorer process handles the folder directly. The net change is a single
5-line edit to the tray menu command, with no COM or P/Invoke code.
When the data folder is already open, the existing window is brought to the
front instead of opening a duplicate window.
Related Issue (if any)
Fixes #2008
Additional Notes
Performance validation
The operation was measured from the physical tray-menu click until Explorer
displayed the exact QuickLook data-folder path in a visible, responsive window
and accepted a click on a file in that folder. The folder was not open before
each measured click; Explorer was allowed to reuse a window it had prepared in
the background.
All three variants were built from the same base revision and run in the same
predeclared session order on the same machine:
explorer.exelaunchShell.Application.Explore)open)The shell
openversion reduced the median by about 78% compared with theoriginal launch, matching the earlier
Explorerevision with simpler code.All 12 measured operations passed the exact-path, visibility, responsiveness,
and click checks. The original launch started a new Explorer process for every
operation; both new variants were handled by the existing Explorer process.
With the folder already open, clicking Open Data Folder again:
open: brought the existing window to the front in about 0.14 s.A representative ETW trace of the original launch (zero lost events) showed:
+37 ms+1047 ms+3026 ms31 msof QuickLook UI-thread sampled CPU (0.85%), so thedelay was not CPU work in QuickLook
These are path-free summaries from one machine running a Windows 11 Insider
build, not a fleet-wide benchmark or formal statistical study. Absolute times
vary with machine state; the comparison is between variants measured in the
same session sequence. The first click after starting QuickLook was slower and
more variable for all variants and is not included in the table. Two planned
sessions ended before any measured operation because of test-harness input
problems. They were retained and not rerun, which is why two variants have
three runs.
Build validation
QuickLook\QuickLook.csprojbuilt successfully in Release configuration.