Skip to content

修复扫描稳定性与数据显示异常,恢复多语言切换并修复仪表盘控件重叠#4

Merged
Haerbin23456 merged 3 commits intoHaerbin23456:mainfrom
adminLAla:dev
Mar 4, 2026
Merged

修复扫描稳定性与数据显示异常,恢复多语言切换并修复仪表盘控件重叠#4
Haerbin23456 merged 3 commits intoHaerbin23456:mainfrom
adminLAla:dev

Conversation

@adminLAla
Copy link
Collaborator

修复 #3
变更概述
本 PR 主要解决扫描过程中卡顿、批量 N/A/0ms、Hook 状态误判等问题;同时恢复从 main 分支丢失的多语言/语言切换功能,并修复仪表盘工具栏控件重叠。

具体修改

  1. 稳定 Hook IPC 扫描链路
  2. 优化超时与重试策略,降低扫描卡顿和连锁失败。
  3. 增强 Hook 状态判定,减少“误断连/状态抖动”。
  4. 对已知不稳定处理器(含 NVIDIA 相关项)增加保护,避免拖慢整轮扫描。
  5. 优化结果语义与筛选能力
  6. 区分“未测量/不支持”和真实错误,减少误导性 0ms。
  7. 新增“仅看已测量”开关,仅展示有效耗时数据。
  8. 恢复多语言能力(中文/英文)
  9. 恢复本地化服务与语言偏好持久化。
  10. 恢复主窗口、设置页、启动流程中的本地化绑定与语言初始化。
  11. 修复界面问题
  12. 修复 Dashboard 搜索/排序/筛选区域控件重叠。
  13. 修复 VSCode UWP 项名称乱码(不再用不稳定 Hook 标题覆盖包名)。

验证结果

  • 已通过构建:dotnet build [ContextMenuProfiler.UI.csproj] -c Debug

手工验证:

  • 扫描稳定性明显提升,卡顿减少。
  • Hook 不再频繁误判为未注入。
  • 中文界面与语言切换恢复正常。
  • 工具栏布局不再重叠。

备注
本分支已先与上游 main 同步并在本地解决冲突后提交。

Copilot AI review requested due to automatic review settings March 4, 2026 13:06
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

该 PR 聚焦于提升系统扫描/Hook IPC 的稳定性与结果语义(减少连锁 N/A/0ms、降低误判断连),并补回多语言切换能力,同时修复 Dashboard 工具栏控件重叠问题。

Changes:

  • 调整 Hook IPC 客户端与 Hook 状态判定逻辑:增加重试/超时策略与“宽限窗口”,降低扫描期间状态抖动与阻塞影响
  • 扫描/展示语义优化:新增“仅看已测量”过滤开关,补充“未测量/不支持”等状态与本地化文本
  • 注入器与扫描器调整:注入/弹出支持多进程匹配,注册表扫描限制并行度避免 CPU 饱和

Reviewed changes

Copilot reviewed 9 out of 9 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
ContextMenuProfiler.UI/Views/Pages/DashboardPage.xaml 调整工具栏布局,引入“仅看已测量”开关并避免控件重叠
ContextMenuProfiler.UI/ViewModels/DashboardViewModel.cs 新增 ShowMeasuredOnly 过滤逻辑并触发重新筛选
ContextMenuProfiler.UI/Core/Services/LocalizationService.cs 为新增过滤开关补充中英文文案
ContextMenuProfiler.UI/Core/Services/HookService.cs 增强 Hook 状态判定与宽限窗口,降低误判断连/抖动
ContextMenuProfiler.UI/Core/RegistryScanner.cs 限制并行度,减少深度扫描时的资源争抢
ContextMenuProfiler.UI/Core/HookIpcClient.cs 调整 IPC 锁/超时/重试策略与 JSON 提取容错
ContextMenuProfiler.UI/Core/BenchmarkService.cs 引入不稳定处理器跳过策略、UWP 命名稳定化、未测量/不支持结果语义
ContextMenuProfiler.UI/Converters/LoadTimeToTextConverter.cs 扩展 N/A 展示条件以匹配新增状态

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +99 to 104
var swRoundTrip = Stopwatch.StartNew();
// Format: "CLSID|Path[|DllHint]"
string requestStr = string.IsNullOrEmpty(dllHint) ? $"{clsid}|{path}" : $"{clsid}|{path}|{dllHint}";
byte[] request = Encoding.UTF8.GetBytes(requestStr);
await client.WriteAsync(request, 0, request.Length);

Copy link

Copilot AI Mar 4, 2026

Choose a reason for hiding this comment

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

GetHookDataAsync applies a timeout to the read via WaitAsync, but the preceding WriteAsync has no timeout/cancellation. If the server side stops draining the pipe (or the pipe becomes back-pressured), this write can block indefinitely and reintroduce scan stalls. Consider using a single CancellationTokenSource with the round-trip timeout and pass its token to ConnectAsync/WriteAsync/ReadAsync (or wrap WriteAsync with WaitAsync as well) so the whole IPC attempt is time-bounded.

Copilot uses AI. Check for mistakes.
Comment on lines +95 to +99
_consecutiveStatusFailures++;

if (CurrentStatus == HookStatus.Active &&
_consecutiveStatusFailures < StatusFailureThreshold &&
(DateTime.UtcNow - _lastKnownActiveAtUtc) <= ActiveGraceWindow)
Copy link

Copilot AI Mar 4, 2026

Choose a reason for hiding this comment

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

GetStatusAsync mutates _consecutiveStatusFailures / _lastKnownActiveAtUtc and CurrentStatus, but it can be invoked concurrently (background polling started in the constructor plus explicit calls from the UI like AutoEnsureHook/ReconnectHook). Without synchronization, concurrent calls can race and produce inconsistent status transitions (e.g., miscounted failures or stale _lastKnownActiveAtUtc). Consider serializing GetStatusAsync with a private SemaphoreSlim/lock so only one status evaluation runs at a time.

Copilot uses AI. Check for mistakes.
Comment on lines +37 to 39
status.Contains("Not Measured", StringComparison.OrdinalIgnoreCase) ||
status.Contains("Unsupported", StringComparison.OrdinalIgnoreCase) ||
status.Contains("No Menu", StringComparison.OrdinalIgnoreCase);
Copy link

Copilot AI Mar 4, 2026

Choose a reason for hiding this comment

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

BenchmarkService can now set Status = "Skipped (Known Unstable)" with TotalTime = 0, but ShouldShowNa doesn’t treat "Skipped" as a non-measured outcome. This will display "0 ms" for skipped entries, reintroducing the misleading 0ms case the PR is trying to eliminate. Consider updating ShouldShowNa to return true for skipped entries (e.g., status.Contains("Skipped", ...)) and align the indentation of the added conditions with the surrounding lines.

Suggested change
status.Contains("Not Measured", StringComparison.OrdinalIgnoreCase) ||
status.Contains("Unsupported", StringComparison.OrdinalIgnoreCase) ||
status.Contains("No Menu", StringComparison.OrdinalIgnoreCase);
status.Contains("Not Measured", StringComparison.OrdinalIgnoreCase) ||
status.Contains("Unsupported", StringComparison.OrdinalIgnoreCase) ||
status.Contains("No Menu", StringComparison.OrdinalIgnoreCase) ||
status.Contains("Skipped", StringComparison.OrdinalIgnoreCase);

Copilot uses AI. Check for mistakes.
@Haerbin23456 Haerbin23456 merged commit 8e2a8c2 into Haerbin23456:main Mar 4, 2026
5 checks passed
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.

3 participants