Skip to content

3.2.1-beta.4 on 0.4.7f6: game crashes right after load when a plain custom NPC exists (InitializeNPC on already initialized NPC, coreclr 0xc0000005) #315

Description

@madjagstudios

Follow-up to #309 (closed). Thanks for the quick beta.3/beta.4 fixes. Construction now works, but the game hard-crashes right after load whenever a plain custom contact exists. Same two-contact minimal repro as in #309, nothing else installed.

Environment: Schedule I 0.4.7f6 (Steam build 25439817), IL2CPP, MelonLoader 0.7.3, S1API 3.2.1-beta.4 (S1API.Il2Cpp.MelonLoader.dll SHA-256 bc0f6f35…0588), S1MAPI 2.0.0, and the two-contact repro mod from #309. No other mods.

What happens:

  1. Both contacts construct and register. Right after load, the repro mod logs NPC.Get("repro_legacy_contact") → PRESENT and NPC.Get("repro_modern_contact") → PRESENT. No Failed to instantiate warnings.
  2. About a second later the process dies. The MelonLoader log just ends. Player.log ends with:
Game loaded
  ScheduleOne.Persistence.<<StartGame>g__LoadRoutine|0>d:MoveNext()
InitializeNPC called on already initialized NPC. First deinitializing...
  ScheduleOne.NPCs.NPC:InitializeNPC(NPCData)
  ScheduleOne.NPCs.NPC:Awake_UserLogic_ScheduleOne.NPCs.NPC_Assembly-CSharp.dll()
  ScheduleOne.NPCs.NPC:Awake()
  1. Windows Application log: coreclr.dll 6.0.3624.51421, exception 0xc0000005, fault offset 0x1d4089, followed by .NET Runtime 1023 "terminated due to an internal error in the .NET Runtime". No Unity crash dump.

Control: with the repro mod removed (S1API beta.4 alone), the same save loads fine.

Reading of it (not verified): a custom contact's GameObject gets activated after load, NPC.Awake calls InitializeNPC on an NPC that S1API already initialized during construction, the game deinitializes it first, and something managed then touches the deinitialized state. That would be a CoreCLR access violation under Il2CppInterop rather than a Unity native crash. The IL2CPP f6 validation may have registered the contacts without staying in-world past the first post-load Awake.

The full MelonLoader log and the Player.log tail are available if useful. Happy to test a fix build.

No activity

Activity on this issue will appear here.

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