RimWorld

RimWorld

Automatic Bed Reassignment
This topic has been locked
LookForBedReassignment: Collection was modified; enumeration operation may not execute.
Getting this error every night:

LookForBedReassignment experienced an exception: Collection was modified; enumeration operation may not execute. at System.ThrowHelper.ThrowInvalidOperationException (System.ExceptionResource resource) [0x0000b] in <eae584ce26bc40229c1b1aa476bfa589>:0 at System.Collections.Generic.List`1+Enumerator[T].MoveNextRare () [0x00013] in <eae584ce26bc40229c1b1aa476bfa589>:0 at System.Collections.Generic.List`1+Enumerator[T].MoveNext () [0x0004a] in <eae584ce26bc40229c1b1aa476bfa589>:0 at System.Linq.Enumerable+WhereListIterator`1[TSource].MoveNext () [0x0004e] in <351e49e2a5bf4fd6beabb458ce2255f3>:0 at BedAssign.Utilities.ClaimUtils.TryMakeSpaceFor (RimWorld.Building_Bed bed, Verse.Pawn pawn) [0x00074] in <7a3b949ab7cb44159816f92054ba8477>:0 at BedAssign.Utilities.ClaimUtils.TryClaimBed (Verse.Pawn pawn, RimWorld.Building_Bed bed, System.Boolean canMakeSpaceFor) [0x000e7] in <7a3b949ab7cb44159816f92054ba8477>:0 at BedAssign.Utilities.PawnBedUtils.PerformBetterBedSearch (System.Linq.IOrderedEnumerable`1[TElement] orderedBeds, RimWorld.Building_Bed currentBed, Verse.Pawn pawn, Verse.Pawn pawnLover, System.String singleOutput, System.String partnerOutput, RimWorld.TraitDef forTraitDef, System.Func`2[T,TResult] betterBedCustomFunc, RimWorld.TraitDef[] excludedOwnerTraitDefs) [0x0017c] in <7a3b949ab7cb44159816f92054ba8477>:0 at BedAssign.BedAssign.LookForBedReassignment (Verse.Pawn pawn) [0x00246] in <7a3b949ab7cb44159816f92054ba8477>:0 at BedAssign.HarmonyPatches.JobPrefix (Verse.Pawn pawn) [0x00000] in <7a3b949ab7cb44159816f92054ba8477>:0 UnityEngine.StackTraceUtility:ExtractStackTrace () (wrapper dynamic-method) Verse.Log:Verse.Log.Error_Patch4 (string) BedAssign.BedAssign:Error (string) BedAssign.HarmonyPatches:JobPrefix (Verse.Pawn) (wrapper dynamic-method) RimWorld.JobGiver_GetRest:RimWorld.JobGiver_GetRest.TryGiveJob_Patch3 (RimWorld.JobGiver_GetRest,Verse.Pawn) Verse.AI.ThinkNode_JobGiver:TryIssueJobPackage (Verse.Pawn,Verse.AI.JobIssueParams) (wrapper dynamic-method) Verse.AI.ThinkNode_PrioritySorter:Verse.AI.ThinkNode_PrioritySorter.TryIssueJobPackage_Patch0 (Verse.AI.ThinkNode_PrioritySorter,Verse.Pawn,Verse.AI.JobIssueParams) (wrapper dynamic-method) Verse.AI.ThinkNode_Priority:Verse.AI.ThinkNode_Priority.TryIssueJobPackage_Patch0 (Verse.AI.ThinkNode_Priority,Verse.Pawn,Verse.AI.JobIssueParams) Verse.AI.ThinkNode_Tagger:TryIssueJobPackage (Verse.Pawn,Verse.AI.JobIssueParams) Verse.AI.ThinkNode_Subtree:TryIssueJobPackage (Verse.Pawn,Verse.AI.JobIssueParams) (wrapper dynamic-method) Verse.AI.ThinkNode_Priority:Verse.AI.ThinkNode_Priority.TryIssueJobPackage_Patch0 (Verse.AI.ThinkNode_Priority,Verse.Pawn,Verse.AI.JobIssueParams) Verse.AI.ThinkNode_Conditional:TryIssueJobPackage (Verse.Pawn,Verse.AI.JobIssueParams) (wrapper dynamic-method) Verse.AI.ThinkNode_Priority:Verse.AI.ThinkNode_Priority.TryIssueJobPackage_Patch0 (Verse.AI.ThinkNode_Priority,Verse.Pawn,Verse.AI.JobIssueParams) (wrapper dynamic-method) Verse.AI.Pawn_JobTracker:Verse.AI.Pawn_JobTracker.DetermineNextJob_Patch0 (Verse.AI.Pawn_JobTracker,Verse.ThinkTreeDef&) Verse.AI.Pawn_JobTracker:TryFindAndStartJob () (wrapper dynamic-method) Verse.AI.Pawn_JobTracker:Verse.AI.Pawn_JobTracker.EndCurrentJob_Patch7 (Verse.AI.Pawn_JobTracker,Verse.AI.JobCondition,bool,bool) (wrapper dynamic-method) Verse.AI.Pawn_JobTracker:Verse.AI.Pawn_JobTracker.JobTrackerTick_Patch0 (Verse.AI.Pawn_JobTracker) (wrapper dynamic-method) Verse.Pawn:Verse.Pawn.Tick_Patch1 (Verse.Pawn) (wrapper dynamic-method) Verse.TickList:Verse.TickList.Tick_Patch2 (Verse.TickList) (wrapper dynamic-method) Verse.TickManager:Verse.TickManager.DoSingleTick_Patch7 (Verse.TickManager) Verse.TickManager:TickManagerUpdate () (wrapper dynamic-method) Verse.Game:Verse.Game.UpdatePlay_Patch5 (Verse.Game) (wrapper dynamic-method) Verse.Root_Play:Verse.Root_Play.Update_Patch1 (Verse.Root_Play)

Full hugslib, if it's helpful: https://gist.github.com/ffc90e50d2a647823da772a52711a21f