Repository navigation
fix(config): look sections up by type in ReflectionManager.GetSection(Type) - #158
Merged
Merged
Conversation
…(Type) It passed type.FullName to TryGetSection(string), which looks up section paths, so it never found anything. JudgeAdjust.Save1P uses it: saving from the practice-mode offset or calibration page crashed the game with 'Section AquaMai.Mods.GameSettings.JudgeAdjust not found'.
审查者指南(小型 PR 中折叠显示)审查者指南此 PR 修复了公共 GetSection(Type) API,使其能够通过完全限定的 CLR 类型名称成功解析配置节,同时保持基于路径的字符串查找行为不变。这一行实现改动由解释性注释支持,并已针对上游程序集中的基于路径和基于类型的查找进行了验证。 按类型查找配置节的时序图sequenceDiagram
participant Mod
participant ReflectionManager
participant TypeLookup as sectionsByFullName
participant Section
Mod->>ReflectionManager: GetSection(type)
ReflectionManager->>ReflectionManager: TryGetSection(type)
ReflectionManager->>TypeLookup: lookup by type.FullName
TypeLookup-->>ReflectionManager: Section
ReflectionManager-->>Mod: ISection
文件级改动
提示和命令与 Sourcery 互动
自定义使用体验访问你的控制面板以:
获取帮助Original review guide in EnglishReviewer's guide (collapsed on small PRs)Reviewer's GuideThis PR fixes the public GetSection(Type) API so it successfully resolves configuration sections by their fully qualified CLR type name, while leaving path-based string lookup unchanged. The one-line implementation change is supported by an explanatory comment and was verified against the upstream assembly for both path- and type-based lookups. Sequence diagram for configuration section lookup by typesequenceDiagram
participant Mod
participant ReflectionManager
participant TypeLookup as sectionsByFullName
participant Section
Mod->>ReflectionManager: GetSection(type)
ReflectionManager->>ReflectionManager: TryGetSection(type)
ReflectionManager->>TypeLookup: lookup by type.FullName
TypeLookup-->>ReflectionManager: Section
ReflectionManager-->>Mod: ISection
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
clansty
reviewed
Oct 9, 2026
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.
ReflectionManager.GetSection(Type)calledTryGetSection(type.FullName, ...). That resolves to thestringoverload, which looks the name up as a section path (GameSettings.JudgeAdjust), not as a full type name (AquaMai.Mods.GameSettings.JudgeAdjust). So it never found anything and always threwKeyNotFoundException: Section <FullName> not found. It now calls theTypeoverload,TryGetSection(type, ...), which already looks upsectionsByFullName.There is no caller in this repo today, but
GetSection(Type)is part of the publicIReflectionManagerinterface. I hit it in a fork where a mod writes its own section back to the config:config.ReflectionManager.GetSection(typeof(JudgeAdjust)), called when saving from an in-game settings page. That crashed the game.Verification
The headless
MonoCecilReflectionProviderandReflectionManagerrun over the upstreamAquaMai.Mods.dll:GetSection("GameSettings.JudgeAdjust")GetSection(typeof(AquaMai.Mods.GameSettings.JudgeAdjust))Section AquaMai.Mods.GameSettings.JudgeAdjust not foundGameSettings.JudgeAdjust)ReflectionManager.GetSection(Type)调用的是TryGetSection(type.FullName, ...),匹配到string重载,按节路径(如GameSettings.JudgeAdjust)而不是完整类型名查找,因此总是抛出Section <FullName> not found。现改为调用已有的Type重载TryGetSection(type, ...)(按sectionsByFullName查找)。本仓库目前没有调用者,但它是公开接口
IReflectionManager的一部分。我在一个分支里让 mod 用GetSection(typeof(JudgeAdjust))把自身配置写回文件时,游戏因此崩溃。验证:对上游AquaMai.Mods.dll,修复前按类型查找失败,修复后成功。Sourcery 摘要
错误修复:
Original summary in English
Sourcery 摘要
错误修复:
Original summary in English
Summary by Sourcery
Bug Fixes: