Fix: Collection was modified; enumeration operation may not execute in C#
You changed a List or Dictionary while a foreach was walking it. Iterate a copy, use RemoveAll, loop backwards with for, or lock both sides. Which mutations throw on .NET 10 and 11, and why Dictionary.Remove does not.