同步 I/O、async void 和静态事件订阅需要整理 [AI Review]
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
- Domain
- desktop, performance
Research direction
Start with the listed call sites in Requester.cs, Request.cs, ProjectQuery.cs, LoaderBase.cs, and the UI files named in the issue. Trace how their callers handle cancellation, UI dispatch, and page lifetimes before changing the synchronous waits or static event subscriptions. Done means meeting all four acceptance checks across the affected network, dialog, loader, and event code; the issue does not identify tests.
Written by the indexing model from the issue text.
Description
🤖 这条 Issue 由 AI 代码审计批量生成,未经人工逐项复核。基线:
dev@2856c2a4(迁移范围9c4f1544..2856c2a4)。证据来自静态代码分析,欢迎在评论中补充或纠正。
现象
网络和文件操作里还有不少同步等待。事件处理器里有 async void,静态事件订阅也缺少释放。
证据
PCL.Launcher.Core/Network/Http/Requester.cs:37,53,58,68:内部使用GetAwaiter().GetResult()。PCL.Launcher.Core/Comp/Request.cs:28,56,86、Comp/ProjectQuery.cs:565,577:用Task.Run包同步网络请求。PCL.Launcher/UI/UiInteraction.cs:64,83,102,121、ExitFlow.cs:80、StartupEffects.cs:237,263、FileDragHandler.cs:137,291,379,540:对话框使用.Result。PCL.Launcher.Core/Loading/LoaderBase.cs:255-259,294-301:用Thread.Sleep(10)轮询,已经存在的WaitForExitAsync没有被调用。PCL.Launcher/Views/Pages/Instance/PageInstanceScreenshot.cs:41:公开的async void Refresh()没有 try/catch。PCL.Launcher/ViewModels/Pages/PageToolsGameLinkViewModel.cs:73-83:订阅 9 个静态事件,Suspend()只取消公告 CTS,没有解除订阅。PCL.Launcher/Views/Pages/Launch/PageLaunchLeft.axaml.cs:63-64,81、PageLaunchRight.axaml.cs:79、PageSetupLeft.axaml.cs:65、MainWindow.axaml.cs:57:静态事件订阅没有对应的解除。
影响
线程池线程会被同步 I/O 占住,取消操作可能失效。页面或 ViewModel 被静态事件保留,重启或测试时无法释放。async void 抛出的异常会进入全局未处理路径。
建议
- 把
Requester改成异步接口,调用方逐步改为await。 - 对话框统一使用
ShowAsync,去掉.Result。 - 把
LoaderBase的异步等待方法接到实际调用点,删除轮询。 - 事件边界保留
async void时补 try/catch,公开方法改成async Task。 - 页面和 ViewModel 实现
IDisposable或OnNavigatedFrom解绑,静态事件成对出现。
验收
- 网络和文件操作不再用
Task.Run包同步调用。 - 对话框调用不再阻塞 UI 线程。
- 页面离开后静态事件不再持有旧实例。
-
async void都有异常处理。
- 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
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from PCL-Community/PCL-CE
-
崩溃日志只按 CRLF 分行Open
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
PCL-Community/PCL-CE#3872 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 62/100
PCL-Community/PCL-CE#3871 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
PCL-Community/PCL-CE#3867 ·
Maintainers usually reply within 1 day
-
[i18n] 安装实例完成后的成功提示未正确本地化Possibly taken @Lokins577 claimed this 35 days ago. Open👍 优质 🚧 正在处理
Difficulty 2/5 1-3 hours Newbie friendliness 62/100
PCL-Community/PCL-CE#3658 · 1 assignee ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
PCL-Community/PCL-CE#3447 ·
Maintainers usually reply within 1 day
All issues in PCL-Community/PCL-CE
Similar issues
-
hand-to-AI
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
CactuseSecurity/firewall-orchestrator#5803 ·
Maintainers usually reply within 1 day
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
Maintainers usually reply within 1 day
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
Maintainers usually reply within 3 days
-
bug python
Difficulty 1/5 Under an hour Newbie friendliness 88/100
ilia-sokolov/OfficeAgent.NET#89 ·
Maintainers usually reply within 13 days