How can I find where this exception is coming from?

I’m getting the following exception after upgrading my entities package but I don’t see any indication as to what file/code is even throwing the exception.

InvalidOperationException: The NativeArray has been deallocated, it is not allowed to access it
Unity.Collections.LowLevel.Unsafe.AtomicSafetyHandle.CheckReadAndThrowNoEarlyOut (Unity.Collections.LowLevel.Unsafe.AtomicSafetyHandle handle) <0x1c990ff8d10 + 0x00052> in <8ff0542c1b944876840eea6545879d3f>:0
Unity.Collections.NativeArray`1[T].CheckElementReadAccess (System.Int32 index) (at C:/buildslave/unity/build/Runtime/Export/NativeArray/NativeArray.cs:117)
Unity.Collections.NativeArray`1[T].get_Item (System.Int32 index) (at C:/buildslave/unity/build/Runtime/Export/NativeArray/NativeArray.cs:138)
BuildChildArraySystem.OnUpdate (Unity.Jobs.JobHandle inputDeps) (at Assets/Scripts/ECS/Systems/TargetHandlers/BuildChildArraySystem.cs:50)
Unity.Entities.JobComponentSystem.InternalUpdate () (at Library/PackageCache/com.unity.entities@0.0.12-preview.29/Unity.Entities/ComponentSystem.cs:635)
Unity.Entities.ScriptBehaviourManager.Update () (at Library/PackageCache/com.unity.entities@0.0.12-preview.29/Unity.Entities/ScriptBehaviourManager.cs:97)
Unity.Entities.ComponentSystemGroup.OnUpdate () (at Library/PackageCache/com.unity.entities@0.0.12-preview.29/Unity.Entities/ComponentSystemGroup.cs:361)
UnityEngine.Debug:LogException(Exception)
Unity.Debug:LogException(Exception) (at Library/PackageCache/com.unity.entities@0.0.12-preview.29/Unity.Entities/Stubs/Unity/Debug.cs:25)
Unity.Entities.ComponentSystemGroup:OnUpdate() (at Library/PackageCache/com.unity.entities@0.0.12-preview.29/Unity.Entities/ComponentSystemGroup.cs:365)
Unity.Entities.ComponentSystem:InternalUpdate() (at Library/PackageCache/com.unity.entities@0.0.12-preview.29/Unity.Entities/ComponentSystem.cs:502)
Unity.Entities.ScriptBehaviourManager:Update() (at Library/PackageCache/com.unity.entities@0.0.12-preview.29/Unity.Entities/ScriptBehaviourManager.cs:97)
Unity.Entities.DummyDelegateWrapper:TriggerUpdate() (at Library/PackageCache/com.unity.entities@0.0.12-preview.29/Unity.Entities/ScriptBehaviourUpdateOrder.cs:129)

also:

A Native Collection has not been disposed, resulting in a memory leak. Allocated from:
Unity.Collections.NativeArray`1:.ctor(Int32, Allocator, NativeArrayOptions) (at C:\buildslave\unity\build\Runtime\Export\NativeArray\NativeArray.cs:43)
Unity.Entities.ComponentChunkIterator:CreateArchetypeChunkArray(MatchingArchetypeList, Allocator, JobHandle&, ComponentGroupFilter&, JobHandle) (at Library\PackageCache\com.unity.entities@0.0.12-preview.29\Unity.Entities\Iterators\ComponentChunkIterator.cs:191)
Unity.Entities.ComponentGroup:CreateArchetypeChunkArray(Allocator) (at Library\PackageCache\com.unity.entities@0.0.12-preview.29\Unity.Entities\Iterators\ComponentGroup.cs:479)
BuildChildArraySystem:OnUpdate(JobHandle) (at Assets\Scripts\ECS\Systems\TargetHandlers\BuildChildArraySystem.cs:34)
Unity.Entities.JobComponentSystem:InternalUpdate() (at Library\PackageCache\com.unity.entities@0.0.12-preview.29\Unity.Entities\ComponentSystem.cs:626)
Unity.Entities.ScriptBehaviourManager:Update() (at Library\PackageCache\com.unity.entities@0.0.12-preview.29\Unity.Entities\ScriptBehaviourManager.cs:97)
Unity.Entities.ComponentSystemGroup:OnUpdate() (at Library\PackageCache\com.unity.entities@0.0.12-preview.29\Unity.Entities\ComponentSystemGroup.cs:361)
Unity.Entities.ComponentSystem:InternalUpdate() (at Library\PackageCache\com.unity.entities@0.0.12-preview.29\Unity.Entities\ComponentSystem.cs:502)
Unity.Entities.ScriptBehaviourManager:Update() (at Library\PackageCache\com.unity.entities@0.0.12-preview.29\Unity.Entities\ScriptBehaviourManager.cs:97)
Unity.Entities.DummyDelegateWrapper:TriggerUpdate() (at Library\PackageCache\com.unity.entities@0.0.12-preview.29\Unity.Entities\ScriptBehaviourUpdateOrder.cs:129)

The two exceptions seem to contradict each other?

Is there an option I can set somewhere that would help me get to the root of the problem?

FWIW I managed to find the troublesome system because it’s run time is >100ms when the exception is thrown.
4400377--400411--upload_2019-4-6_13-47-41.png