校验逐键枚举目录,Comp 缓存和页面缓存没有上限 [AI Review]

Open
#3,823 0 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
5/5
Estimated time
Over a week
Newbie friendliness
35/100
Issue type
Refactor
Clarity
Mostly clear
Activity status
Active
Tech stack
csharp

Research direction

Start with the synchronous validation path in PCL.Launcher/UI/Controls/Inputs/MyTextBox.cs and the filesystem validators it calls, then trace the static caches and page host lifetimes named in the issue. The issue proposes debounce, lifecycle caching, bounded Comp caches, and page host eviction or disposal across several subsystems. Done means input no longer enumerates on every character, the Comp cache has an enforced capacity, and memory stays stable during extended download page use.

Written by the indexing model from the issue text.

Description

⭕ 等待处理

🤖 这条 Issue 由 AI 代码审计批量生成,未经人工逐项复核。基线:dev@2856c2a4(迁移范围 9c4f1544..2856c2a4)。证据来自静态代码分析,欢迎在评论中补充或纠正。

现象

输入校验在每次按键时同步访问文件系统。资源缓存和页面宿主缓存都没有容量上限。

证据

  • PCL.Launcher/UI/Controls/Inputs/MyTextBox.cs:225-259:文本变化时同步执行校验。
  • PCL.Core/Utils/Validate/FileNameValidator.cs:58-77、FolderNameValidator.cs:56-71:检查父目录下是否存在同名项。
  • PCL.Core/Utils/Validate/FileSystemValidator.cs:13-29:每次校验都构造无效字符集合并做 LINQ 过滤。
  • PCL.Launcher.Core/Comp/ProjectQuery.cs:17、Comp/FileCache.cs:12:静态缓存没有上限。
  • PCL.Launcher.Core/Comp/Project.cs:126:CompProject 构造函数把自己加入全局缓存。
  • PCL.Launcher/Views/Pages/Download/PageDownloadHost.cs:12,45-55:每个访问过的下载子页都保留。
  • PCL.Launcher/Navigation/PageRegistry.cs:12,81-110:所有页面宿主启动时创建并常驻。

影响

versions 目录很大时,输入实例名会卡顿。长时间浏览资源页和下载页,内存会持续增长。

建议

  • 校验增加 150–250ms 防抖,目录枚举结果在页面生命周期内缓存。
  • 提交或失焦时执行完整校验。
  • Comp 缓存改成带 LRU、TTL 和容量上限的实例服务,移除构造函数副作用。
  • 页面宿主增加 LRU 或 IDisposable,离开页面时释放图片、定时器和订阅。

验收

  • 输入实例名时不再每个字符都枚举目录。
  • Comp 缓存有明确上限,超过后能淘汰。
  • 长时间浏览下载页内存保持稳定。
Dominant language
C#
Stars
4.3k
Forks
148
Avg merge
1d 6h
Merged PRs (30d)
64

Getting set up

This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from PCL-Community/PCL-CE

All issues in PCL-Community/PCL-CE

Similar issues

More C# issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.