Enumeration Assertion failures crash and corruption

X-Mag-X X-Mag-X · 14 days ago

Hello once again! Since first posting this , I've continued investigating recurring entity-enumeration assertions across multiple users, new and existing saves, and many combinations of mods, and I’m contacting the authors of each mod appearing in the relevant stacks in game-logs. This appears to be an COI-wide mod-issue affecting many mods when used together, also affecting your mod. Symptoms range from: silent, feature-failure, crashing and possible /save-data-corruption.

COI’s shared entity collection is not thread-safe and appears to permits only one properly nested enumeration at a time. If main/UI-thread code scans live simulation entities while the simulation thread is also scanning them, the shared enumerator state can be overwritten, producing errors such as “Outer enumerator finished first.” The function named in the assertion may be the affected caller rather than the original cause.

In your mod's case, the symptoms are severe and immediate: A Crash shortly after placing parking spots as they are calling vehicles; An un-timely auto-save during that crash may become corrupted.


Report (AI Generated)
This is the assertion involving Vehicle Parking Spots:

A 14:36:12,897 ~Sim: Outer enumerator finished first?

at Mafi.Collections.LystMutableDuringIter`1+EnumeratorClass.Dispose()
at Mafi.Core.Entities.EntitiesManager.GetAllEntitiesOfType.MoveNext()
at VehicleParkingSpots.ParkingRuntime.TryReserve(...)
at VehicleParkingSpots.ParkingRuntime.OnUpdate()
at Mafi.Core.Simulation.SimLoopEvents.InvokeGameStep(...)
at Mafi.Core.Simulation.SimulationBackgroundTask.PerformWork()

This particular call is on the simulation thread, so it may be the affected enumerator rather than the initiating cause. Could you check whether Vehicle Parking Spots has any UI, Unity Update, rendering, or other main-thread code that directly enumerates live entities, and whether TryReserve can begin a nested enumeration while another remains active?

A COI developer advised transferring data through the sync phase or using a synchronized snapshot instead of enumerating live simulation collections from the main thread.


For more information you may see here:
https://discord.com/channels/803508556325584926/1552336216199008388/1552336216199008388
I have been documenting and listing all mods observed to collide in an attempt to find solutions for the community/users. Feel free to reach out if you have any questions. My hope is that mod-users do not risk losing worlds that can slowly become corrupt after dozens or hundreds of hours, or sooner, in some cases.

Edited 14 days ago
68 Showing 1–2 of 2