Skip to content

Fix bugs and harden codebase: navigation sync, InfoBar state, CTS leak, XML injection, Dispose pattern#5

Draft
Copilot wants to merge 5 commits intodevfrom
copilot/fix-pr-issues-and-improvements
Draft

Fix bugs and harden codebase: navigation sync, InfoBar state, CTS leak, XML injection, Dispose pattern#5
Copilot wants to merge 5 commits intodevfrom
copilot/fix-pr-issues-and-improvements

Conversation

Copy link
Contributor

Copilot AI commented Mar 2, 2026

Full codebase audit fixing correctness bugs, a resource leak, a security issue, and Dispose pattern violations.

PR #4 review fixes

  • AppSettings.UpdateMode default 2→0: Prevented silent auto-update+restart without user consent
  • IsVelopackInstalled: Property→method to avoid UpdateManager instantiation on every access
  • Deduplicate ResolveAndPersistRecommendedChannel: Single call site in App.OnLaunched; UpdateViewModel reads persisted setting directly
  • UpdateViewModel cache hygiene: Clear _cachedUpdate on failure; reuse UpdateService via _lastCheckedPrerelease tracking
  • CI restore/build parity: Add -p:WindowsPackageType=None to dotnet restore to match dotnet build --no-restore

Codebase-wide audit fixes

  • MainWindow.NavigateTo ignores FooterMenuItems: Settings (in footer) never got nav selection synced. Fix: MenuItems.Concat(FooterMenuItems)
  • MainWindow.ShowInfo leaks ActionButton: After ShowInfoWithAction, subsequent ShowInfo calls left the old button visible. Fix: GlobalInfoBar.ActionButton = null
  • AppSettings.DebounceSave CTS leak + race: Old CancellationTokenSource was canceled but never disposed; concurrent Set<T> calls raced on _saveCts. Fix: Interlocked.Exchange + Dispose
  • AutoStartHelper.CreateTask XML injection: Username/path interpolated raw into XML template. Fix: SecurityElement.Escape() on all dynamic values
var escapedUserId = SecurityElement.Escape($@"{Environment.UserDomainName}\{Environment.UserName}");
var escapedExePath = SecurityElement.Escape(exePath);
  • DashboardViewModel.Dispose: Missing GC.SuppressFinalize(this)

🔒 GitHub Advanced Security automatically protects Copilot coding agent pull requests. You can protect all pull requests by enabling Advanced Security for your repositories. Learn more about Advanced Security.

Copilot AI and others added 2 commits March 2, 2026 14:43
- UpdateMode 默认值从 2 改为 0(避免未经用户同意自动更新)
- IsVelopackInstalled 从属性改为方法,避免每次访问创建 UpdateManager
- 移除 UpdateViewModel 中重复的 ResolveAndPersistRecommendedChannel 调用
- 检查更新前和失败时清除缓存,防止使用过期更新信息
- 复用 UpdateService 实例(通道未变时不重复创建)
- CI Restore 步骤添加 -p:WindowsPackageType=None 与 Build 保持一致

Co-authored-by: WSXYT <102407247+WSXYT@users.noreply.github.com>
Co-authored-by: WSXYT <102407247+WSXYT@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix issues from PR and enhance project best practices fix: address PR #4 review findings — update safety, service lifecycle, CI consistency Mar 2, 2026
Copilot finished work on behalf of WSXYT March 2, 2026 14:48
Copilot AI and others added 2 commits March 2, 2026 16:16
- NavigateTo 现遍历 FooterMenuItems,修复设置页导航选中不同步
- ShowInfo 清除上次 ShowInfoWithAction 残留的 ActionButton
- DebounceSave 释放旧 CancellationTokenSource 避免资源泄漏
- AutoStartHelper XML 转义用户名和路径防止注入
- DashboardViewModel.Dispose 添加 GC.SuppressFinalize

Co-authored-by: WSXYT <102407247+WSXYT@users.noreply.github.com>
Co-authored-by: WSXYT <102407247+WSXYT@users.noreply.github.com>
Copilot AI changed the title fix: address PR #4 review findings — update safety, service lifecycle, CI consistency Fix bugs and harden codebase: navigation sync, InfoBar state, CTS leak, XML injection, Dispose pattern Mar 2, 2026
Copilot finished work on behalf of WSXYT March 2, 2026 16:22
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.

2 participants