[3.5.0-pre] Key not found exception when removing the same entity multiple times
Closed this issue · 1 comments
g-jozsef commented
The following error is thrown when removing the same entity twice
void Test()
{
var simpleSubmissionEntityViewScheduler = new SimpleEntitiesSubmissionScheduler();
var enginesRoot = new EnginesRoot(simpleSubmissionEntityViewScheduler);
var entityFactory = enginesRoot.GenerateEntityFactory();
var entityFunctions = enginesRoot.GenerateEntityFunctions();
var r = entityFactory.BuildEntity<EntityDescriptor>(2, BuildGroup);
simpleSubmissionEntityViewScheduler.SubmitEntities();
entityFunctions.RemoveEntity<EntityDescriptor>(r.EGID);
entityFunctions.RemoveEntity<EntityDescriptor>(r.EGID);
simpleSubmissionEntityViewScheduler.SubmitEntities();
}
record struct ComponentA(uint A1) : IEntityComponent;
sealed class EntityDescriptor : GenericEntityDescriptor<ComponentA> { }
Svelto.DataStructures.SveltoDictionaryException: Key not found
at Svelto.ECS.EnginesRoot.RemoveEntities(FasterDictionary`2 removeOperations, FasterList`1 entitiesRemoved, EnginesRoot enginesRoot)
at Svelto.ECS.EntitiesOperations.ExecuteRemoveAndSwappingOperations(Action`3 swapEntities, Action`3 removeEntities, Action`2 removeGroup, Action`3 swapGroup, EnginesRoot enginesRoot)
at Svelto.ECS.EnginesRoot.EntitiesSubmitter.SubmitEntities()
at Svelto.ECS.Schedulers.SimpleEntitiesSubmissionScheduler.SubmitEntities()
at AmmoTest.ECS.MultipleRemoveTests.ShouldNotThrowForMultipleRemove() in E:\projects\akrogames\ammo\ammo-server\tests\AmmoTest\ECS\MultipleRemoveTests.cs:line 51
at System.RuntimeMethodHandle.InvokeMethod(Object target, Void** arguments, Signature sig, Boolean isConstructor)
at System.Reflection.MethodInvoker.Invoke(Object obj, IntPtr* args, BindingFlags invokeAttr)
I also debugged it and the issue is probably that
calls into an entitylocator remove
and it fails here:
the egidToReference does not contain the egid that we're removing the second time
sebas77 commented
ok fixed thanks