Burst 1.1.0 fails to compile NativeHashMap

I already downgraded but the error is unable to resolve TKey in NativeHashMap.cs line 516.

It fails in a fairly specific context for me, these are the two context’s I saw failures in.

  • Where the hashmap is not declared on the job itself, but is passed in contained in another struct. It fails on methods on that container struct that access the hashmap.
  • where the hashmap is declared on the job, but inside the job it’s passed to a static helper method. It’s inside that helper method where it’s unable to resolve.

I’m on 1.1.0 preview 4

I think I do this exact thing and I have had no issue since upgrading.

Here is what I’m doing just to make sure I understood right.

[BurstCompile]
public struct ObstructionChangedJob : IJobForEach<DynamicObstruction, LocalToWorld>
{
    public ObstructionChangedImpl Impl;

    // ..

    /// <inheritdoc />
    public void Execute(ref DynamicObstruction observations, [ReadOnly] [ChangedFilter] ref LocalToWorld localToWorld)
    {
        // ..

        this.Impl.Execute(localToWorld.Position.xz);
    }
}

ObstructionChangedImpl containers NativeMultiHashMaps

public struct ObstructionChangedImpl
{
    // ...

    public NativeMultiHashMap<int, Entity>.Concurrent ClearMap;

    public NativeMultiHashMap<int, VisionData>.Concurrent VisionMap;

Ya that’s basically the pattern but with methods inside ObstructionChangedImpl that do something. However NativeMultiHashMap doesn’t fail for me just NativeHashMap. One of my jobs that fails literally has the same pattern but using NativeMultiHashMap several lines above where the NativeHashMap version fails to compile.

NativeHashMap declares it’s own iterator internally, so it seems something goes wrong there, the generics info isn’t making it through for some reason.

Easy to repro, bug report is uploading now.

Case 1168823

Thanks for the repro, this was a corner case when using a vector type as a key. We have a fix and it should be available in the next release.

1 Like

The new burst 1.1.1 should fix this issue

1 Like