Compilation was requested for method ... but it is not a known Burst entry point.

I have a job which works perfectly fine and had no issues in Unity 2019.4 (Burst 1.2.3), but when I run it in Unity 2022.1 (Burst 1.7.4) it gives me this warning (but still works as intended):

Compilation was requested for method `UnityEngine.Jobs.IJobParallelForTransformExtensions+TransformParallelForLoopStruct`1[[FlexiMotion.Jobs.ExtractRotationsJob, Kybernetik.FlexiMotion, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null]], UnityEngine.CoreModule, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null::Execute(FlexiMotion.Jobs.ExtractRotationsJob&, Kybernetik.FlexiMotion, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null|System.IntPtr, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089|System.IntPtr, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089|Unity.Jobs.LowLevel.Unsafe.JobRanges&, UnityEngine.CoreModule, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null|System.Int32, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089)` but it is not a known Burst entry point. [B]This may be because the [BurstCompile] method is defined in a generic class, and the generic class is not instantiated with concrete types anywhere in your code[/B].

The job struct isn’t generic or nested in a class, and I have a field of that exact type in the script that runs it:

[BurstCompile]
public struct ExtractRotationsJob : IDisposable, IJobParallelForTransform
{
    [ReadOnly] public NativeArray<quaternion> inLocalRotations;

    [WriteOnly] public NativeArray<quaternion> outWorldRotations;

    public ExtractRotationsJob(int count)
    {
        inLocalRotations = new NativeArray<quaternion>(
            count, Allocator.Persistent, NativeArrayOptions.UninitializedMemory);
        outWorldRotations = new NativeArray<quaternion>(
            count, Allocator.Persistent, NativeArrayOptions.UninitializedMemory);
    }

    public void Dispose()
    {
        inLocalRotations.Dispose();
        outWorldRotations.Dispose();
    }

    public void Execute(int index, TransformAccess transform)
    {
        outWorldRotations[index] = math.mul(transform.rotation, inLocalRotations[index]);
    }
}

This issue seems to have been caused by the fact that I was using a custom [BurstCompile] attribute (which inherits from [Unity.Burst.BurstCompile]) on my jobs to specify the same optimization flags for all of them. Directly using [Unity.Burst.BurstCompile] on my jobs avoids the warning and gives the expected performance increase.

Burst 1.6.0 added the ability to put a [BurstCompile] attribute on the whole assembly so I’m doing that now, but a custom class that inherits from it should also work so I’d still consider this a bug worth fixing.