Cannot delete entities from space (0.15.1)
Posted: Tue Mar 22, 2011 12:25 pm
Hi Norbo,
I need some help tracking down the following exceptions:
When I remove an entity with attached eventhandler from it's Space by Space.Remove(), the following error occurs:
"Collection was modified; enumeration operation may not execute."
at System.ThrowHelper.ThrowInvalidOperationException(ExceptionResource resource)
at System.Collections.Generic.List`1.Enumerator.MoveNextRare()
at System.Collections.Generic.List`1.Enumerator.MoveNext()
at BEPUphysics.OtherSpaceStages.DeferredEventDispatcher.UpdateStage()
at BEPUphysics.ProcessingStage.Update()
at BEPUphysics.Space.DoTimeStep()
at BEPUphysics.Space.Update(Single dt)
...
If I call CollisionInformation.Events.RemoveAllEvents() before removing the entity from it's space, the following error occurs:
"Object reference not set to an instance of an object."
at BEPUphysics.Collidables.Events.ContactEventManager`1.DispatchEvents()
at BEPUphysics.Collidables.Events.EntryEventManager`1.BEPUphysics.OtherSpaceStages.IDeferredEventCreator.DispatchEvents()
at BEPUphysics.OtherSpaceStages.DeferredEventDispatcher.UpdateStage()
at BEPUphysics.ProcessingStage.Update()
at BEPUphysics.Space.DoTimeStep()
at BEPUphysics.Space.Update(Single dt)
I need some help tracking down the following exceptions:
When I remove an entity with attached eventhandler from it's Space by Space.Remove(), the following error occurs:
"Collection was modified; enumeration operation may not execute."
at System.ThrowHelper.ThrowInvalidOperationException(ExceptionResource resource)
at System.Collections.Generic.List`1.Enumerator.MoveNextRare()
at System.Collections.Generic.List`1.Enumerator.MoveNext()
at BEPUphysics.OtherSpaceStages.DeferredEventDispatcher.UpdateStage()
at BEPUphysics.ProcessingStage.Update()
at BEPUphysics.Space.DoTimeStep()
at BEPUphysics.Space.Update(Single dt)
...
If I call CollisionInformation.Events.RemoveAllEvents() before removing the entity from it's space, the following error occurs:
"Object reference not set to an instance of an object."
at BEPUphysics.Collidables.Events.ContactEventManager`1.DispatchEvents()
at BEPUphysics.Collidables.Events.EntryEventManager`1.BEPUphysics.OtherSpaceStages.IDeferredEventCreator.DispatchEvents()
at BEPUphysics.OtherSpaceStages.DeferredEventDispatcher.UpdateStage()
at BEPUphysics.ProcessingStage.Update()
at BEPUphysics.Space.DoTimeStep()
at BEPUphysics.Space.Update(Single dt)