问题描述(此描述由ai生成):
在使用字体替换功能时,点击“替换”后,WebUI 界面会长时间卡在替换进度中无响应(转圈状态),等待超过 30 分钟以上仍无任何变化,且无法通过界面取消,只能强制结束进程。查看后台日志发现,替换流程因抛出未处理的 NullReferenceException 而异常中断,但由于缺乏异常捕获机制,导致前端 UI 任务静默挂起。
复现步骤:
加载游戏目录(该游戏为 Mono 架构,BepInEx 环境)。
进入字体替换功能,点击扫描。
扫描结果为:0 个资产文件,1 个 Bundle 文件,共找到 22 个字体。
选择源字体为:SourceHanSans_U2020 + SourceHanSansSC-Regular.otf。
点击开始替换,界面即刻卡死。
错误日志:
18:10:31
WRN
TmpFontGeneratorService
无法注入 Material 属性 _GradientScale
Exception: System.NullReferenceException: Object reference not set to an instance of an object.
at AssetsTools.NET.AssetTypeValueField.get_AsString()
at XUnityToolkit_WebUI.Services.TmpFontGeneratorService.InjectIntoTemplate(FontGenerationRequest request, String fontName, List1 allGlyphs, List1 atlasPages, Int32 atlasWidth, Int32 atlasHeight, Single ascender, Single descender, Single lineHeight, Int32 padding, Int32 actualSamplingSize, String outputPath)
18:11:25
WRN
TmpFontGeneratorService
无法注入 Material 属性 _GradientScale
Exception: System.NullReferenceException: Object reference not set to an instance of an object.
at XUnityToolkit_WebUI.Services.TmpFontGeneratorService.InjectIntoTemplate(FontGenerationRequest request, String fontName, List1 allGlyphs, List1 atlasPages, Int32 atlasWidth, Int32 atlasHeight, Single ascender, Single descender, Single lineHeight, Int32 padding, Int32 actualSamplingSize, String outputPath)
环境信息:
工具版本: 4.1.202603292321
游戏名称: Rhell
运行环境: Windows, Mono (BepInEx 5)
扫描特征: 仅 1 个 Bundle 文件,内含 22 个 TMP 字体资产。
初步分析与建议:
根本原因: 该游戏的 TMP 版本或自定义 Shader 导致标准 Material 中不存在 _GradientScale 属性,AssetTypeValueField 取值为 null,调用 get_AsString() 时触发空指针。
UI 卡死原因: InjectIntoTemplate 方法抛出异常后,未被外层逻辑正确捕获或传递,导致异步替换任务既未完成、也未报错退出,前端 WebSocket/轮询陷入死等。
修复建议:
在 TmpFontGeneratorService.InjectIntoTemplate 中对获取到的 AssetTypeValueField 增加 null 判断,找不到对应属性时使用默认值或跳过。
优化异常处理链路,确保替换流程中发生任何 Exception 时,能将错误信息正确推送到 WebUI 前端提示用户,并终止当前的“替换中”加载状态。
问题描述(此描述由ai生成):
在使用字体替换功能时,点击“替换”后,WebUI 界面会长时间卡在替换进度中无响应(转圈状态),等待超过 30 分钟以上仍无任何变化,且无法通过界面取消,只能强制结束进程。查看后台日志发现,替换流程因抛出未处理的 NullReferenceException 而异常中断,但由于缺乏异常捕获机制,导致前端 UI 任务静默挂起。
复现步骤:
加载游戏目录(该游戏为 Mono 架构,BepInEx 环境)。
进入字体替换功能,点击扫描。
扫描结果为:0 个资产文件,1 个 Bundle 文件,共找到 22 个字体。
选择源字体为:SourceHanSans_U2020 + SourceHanSansSC-Regular.otf。
点击开始替换,界面即刻卡死。
错误日志:
18:10:31
WRN
TmpFontGeneratorService
无法注入 Material 属性 _GradientScale
Exception: System.NullReferenceException: Object reference not set to an instance of an object.
at AssetsTools.NET.AssetTypeValueField.get_AsString()
at XUnityToolkit_WebUI.Services.TmpFontGeneratorService.InjectIntoTemplate(FontGenerationRequest request, String fontName, List
1 allGlyphs, List1 atlasPages, Int32 atlasWidth, Int32 atlasHeight, Single ascender, Single descender, Single lineHeight, Int32 padding, Int32 actualSamplingSize, String outputPath)18:11:25
WRN
TmpFontGeneratorService
无法注入 Material 属性 _GradientScale
Exception: System.NullReferenceException: Object reference not set to an instance of an object.
at XUnityToolkit_WebUI.Services.TmpFontGeneratorService.InjectIntoTemplate(FontGenerationRequest request, String fontName, List
1 allGlyphs, List1 atlasPages, Int32 atlasWidth, Int32 atlasHeight, Single ascender, Single descender, Single lineHeight, Int32 padding, Int32 actualSamplingSize, String outputPath)环境信息:
工具版本: 4.1.202603292321
游戏名称: Rhell
运行环境: Windows, Mono (BepInEx 5)
扫描特征: 仅 1 个 Bundle 文件,内含 22 个 TMP 字体资产。
初步分析与建议:
根本原因: 该游戏的 TMP 版本或自定义 Shader 导致标准 Material 中不存在 _GradientScale 属性,AssetTypeValueField 取值为 null,调用 get_AsString() 时触发空指针。
UI 卡死原因: InjectIntoTemplate 方法抛出异常后,未被外层逻辑正确捕获或传递,导致异步替换任务既未完成、也未报错退出,前端 WebSocket/轮询陷入死等。
修复建议:
在 TmpFontGeneratorService.InjectIntoTemplate 中对获取到的 AssetTypeValueField 增加 null 判断,找不到对应属性时使用默认值或跳过。
优化异常处理链路,确保替换流程中发生任何 Exception 时,能将错误信息正确推送到 WebUI 前端提示用户,并终止当前的“替换中”加载状态。