Repository navigation
Conversation
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.
类型
这个 Pull Request 做了什么?
修复 IPC 广播期间对等端连接或断开导致的崩溃。课程状态切换会通过 async void 事件处理器调用广播;此前直接遍历 ConnectedPeers,并在循环中 await 发送,连接回调此时增删集合会抛出 InvalidOperationException(Collection was modified),继而传播到 UI Dispatcher。
现场报告版本为 2.1.0.1,从不上课进入第一节课时崩溃:
5382ab11c2da4148a1613e349fa013baIpcService.BroadcastNotificationAsync(String id):45LessonsService.<.ctor>b__108_1:246核对了稳定版 2.1.0.1、测试版 2.1.1.1、master 和 develop/v2/misha-alpha,均保留该遍历方式。未找到已合并或进行中的对应竞态修复。
实现说明
依赖版本 dotnetCampus.Ipc 2.0.0-alpha410 的 NotifyAsync 会把写管道期间的异常包装为 IpcRemoteException;该分支已在真实命名管道的断开竞态测试中复现。
相关 Issue
Related to #602;#1325 已标记为其重复问题。历史 #475 / #487 处理的是 IPC 广播中的空引用异常,与本次集合枚举竞态不同。
验证
在 Windows 上完成:
dotnet build ClassIsland.Desktop/ClassIsland.Desktop.csproj -c Debug成功;最终修改后再次构建成功,0 errors(增量构建 264 warnings)。git diff --check通过。上述临时测试项目不包含在本 PR;本 PR 仅修改 IpcService.cs。未在报告故障的教室机器上执行课程切换和插件组合端到端验证,也未判定现场具体由哪个客户端触发连接变化。
分支与审查说明
贡献指南建议稳定版 Bug 修复以对应维护分支为基础。已核对上游分支,目前没有 2.1 维护分支,因此本 PR 基于最新 master(235914a2);现有 2.0 分支对应旧版本。
本次代码实现与本地验证由 Codex 根据提交者提供的故障信息和指示完成。目前尚未经过人工代码审查;自动测试和静态检查不代表人工审阅。贡献指南不建议在没有人为干预的情况下完全使用生成式 AI 实现贡献,合并前应由提交者或维护者审阅该补丁。
本 PR 不涉及 UI 变化,因此没有附加截图或录屏;验证证据为上面的构建、回归及真实命名管道测试结果。
检查清单