Skip to content

Crash on game version 0.10.35.29057 — AddVeinPatches RemoveHeightLimit Transpiler ArgumentOutOfRangeException #98

Description

@ykjsxhb

Summary / 概述

GenesisBook 3.2.3 fails to load on game version 0.10.35.29057 with an ArgumentOutOfRangeException inside AddVeinPatches.PlanetAlgorithm_GenerateVeins_RemoveHeightLimit_Transpiler. The mod's CHANGELOG.md lists v0.10.34.28455 as the latest adapted version, so this looks like the transpiler's IL pattern no longer matches the new game build.

GenesisBook 3.2.3 在游戏版本 0.10.35.29057 上加载失败,AddVeinPatches.PlanetAlgorithm_GenerateVeins_RemoveHeightLimit_Transpiler 抛出 ArgumentOutOfRangeException。看起来是 transpiler 的 IL 匹配模式在新版本游戏上失效了。

Error Report / 报错日志

Error report: Game version 0.10.35.29057 with 41 mods used.
possible candidates: [GenesisBook.InstallationCheck3.2.3][GenesisBook3.2.3]
ArgumentOutOfRangeException: Index was out of range. Must be non-negative and less than the size of the collection.
Parameter name: index
List<T>.get_Item (int index); (IL_0009)
HarmonyLib.CodeMatcher.get_Labels (); (IL_000C)
ProjectGenesis.Patches.AddVeinPatches.PlanetAlgorithm_GenerateVeins_RemoveHeightLimit_Transpiler (System.Collections.Generic.IEnumerable`1[T] instructions); (IL_0082)
System.Reflection.RuntimeMethodInfo.Invoke (object obj, System.Reflection.BindingFlags invokeAttr, System.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture); (IL_006A)
Rethrow as TargetInvocationException: Exception has been thrown by the target of an invocation.
HarmonyLib.PatchClassProcessor.ReportException (System.Exception exception, System.Reflection.MethodBase original); (IL_0045)
HarmonyLib.PatchClassProcessor.Patch (); (IL_0084)
HarmonyLib.Harmony.PatchAll (System.Type type); (IL_0008)
ProjectGenesis.ProjectGenesis.Awake (); (IL_0213)
[== Mods on stack trace ==]: [ProjectGenesis]

Root Cause Analysis / 根因分析

I decompiled both ProjectGenesis.dll (v3.2.3) and the current game Assembly-CSharp.dll (0.10.35.29057) to investigate:

我反编译了 ProjectGenesis.dll (v3.2.3) 和当前游戏的 Assembly-CSharp.dll (0.10.35.29057) 对比分析:

  1. PlanetAlgorithm_GenerateVeins_RemoveHeightLimit_Transpiler first does MatchForward(throwOnNotFound: true, [ldfld PlanetData.radius, blt]) — that pattern still matches in 0.10.35.
  2. Then it clones the matcher and does a second MatchForward(throwOnNotFound: false, [ldc.i4.0, stloc.s]) to find the boolean-flag init that follows the continue; block.
  3. In 0.10.35 the second pattern no longer matches at the expected offset, so Pos becomes -1, and the subsequent val2.Labels.First() throws ArgumentOutOfRangeException.

The transpiler is unguarded (no IsValid check before accessing .Labels), which is why the pattern drift becomes a hard crash instead of a graceful no-op.

这个 transpiler 没有 IsValid 保护,匹配失败时 Pos = -1,访问 .Labels 就直接抛异常了。

Scope / 影响面

I scanned all 124 [HarmonyTranspiler] methods in ProjectGenesis.dll. The vast majority are unguarded MatchForward/MatchBack callers, so more of them may break on 0.10.35 as the player progresses (research lab, quantum storage, mega-assembler, UI windows, etc.). This one is just the first to fire because Awake runs it at plugin load.

我扫了一下 ProjectGenesis.dll 里的 124 个 [HarmonyTranspiler],绝大多数都是无保护的 MatchForward/MatchBack 调用。当前崩溃的只是第一个,后续玩家推进游戏(研究站、量子储物、巨构装配厂、UI 窗口等)可能会陆续踩到其他的。

Environment / 环境

  • Game version: 0.10.35.29057
  • GenesisBook: 3.2.3 (Thunderstore)
  • BepInEx: 5.x (via Thunderstore Mod Manager)
  • Other relevant framework mods: CommonAPI 1.6.7, DSPModSave, LDBTool, NebulaMultiplayerModApi 2.1.0, ErrorAnalyzer 1.3.3, AssemblerUI 3.0.0
  • Side note: CommonAPI itself also warns it was built for 0.10.33.26941.

Question / 请问

Is a 0.10.35 compatibility update on the roadmap? If it would help, I'm happy to test experimental builds or provide more IL diffs against 0.10.34.28455.

请问有适配 0.10.35 的计划吗?如果需要,我可以帮忙测试实验版本,或者提供更详细的 IL 对比(0.10.34.28455 vs 0.10.35.29057)。

Thanks for the great mod! / 感谢你们的杰出工作!

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions