Thread Access Violation Crash in Build

In the latest entities package (0.14) I have noticed a crash when attempting to run a build. I have already filed a bug report but managed to narrow it down to entities (Case 1270257). Would someone be able to confirm it is happening to them as well?

Steps:

  • New 2020.2a19 project
  • Latest Entities (0.14) and Burst (1.4) packages
  • Include below code in your assets.
  • Build.
  • Run build

In theory it should crash right away when it tries to OnUpdate in the class.

Minimal class file used to crash the build.

using Unity.Entities;

public class EntityCrashSystem : SystemBase {
    private EndSimulationEntityCommandBufferSystem _ecb;
    private EntityQuery _query;

    protected override void OnCreate() {
        _ecb = World.GetExistingSystem<EndSimulationEntityCommandBufferSystem>();
        _query = GetEntityQuery(new EntityQueryDesc() {
            None = new ComponentType[] {typeof(Handled)},
        });
    }

    public struct Handled : IComponentData { }

    protected override void OnUpdate() { _ecb.CreateCommandBuffer().AddComponent<Handled>(_query); }
}

This is certainly an error that has been bugging me. I thought I had set up something wrong, but from your research I see that this bug is caused by Entities. It’s a shame you haven’t found a solution to anything.