Possible Burst bug

I got a function that is correctly compiled by burst, but then when it runs, it says:

E:\RobocraftX\Assets\Code\RobocraftECS\Contexts\Scenes\Character\Camera\Engines\LocalCameraSphereCastEngine.cs(136,25): Burst error BC0102: Unexpected internal compiler error while processing function IL_009f: ldfld System.UInt32 Svelto.ECS.EGID::entityID args(IL_009a): System.InvalidOperationException: The struct field Svelto.ECS.EGID Svelto.ECS.Extensions.Unity.UECSSveltoEGID::egid’s struct comes from an unaddressable source: IL_0095: call !0 Unity.Entities.ComponentDataFromEntity1<Svelto.ECS.Extensions.Unity.UECSSveltoEGID>::get_Item(Unity.Entities.Entity) args(IL_008e, IL_0093) at Burst.Compiler.IL.Transforms.ExplicitLayoutTransform.ForceFieldAccessToAddress (Burst.Compiler.IL.Syntax.ILInstruction inst, System.Boolean forceAddress) [0x000fb] in <5365ccf18ec94235b5e31dbc5844b7eb>:0 at Burst.Compiler.IL.Transforms.ExplicitLayoutTransform.ForceFieldAccessToAddress (Burst.Compiler.IL.Syntax.ILInstruction inst, System.Boolean forceAddress) [0x000b7] in <5365ccf18ec94235b5e31dbc5844b7eb>:0 at Burst.Compiler.IL.Transforms.ExplicitLayoutTransform.VisitImpl (Burst.Compiler.IL.Syntax.ILInstruction inst) [0x00010] in <5365ccf18ec94235b5e31dbc5844b7eb>:0 at Burst.Compiler.IL.ILVisitor.Visit (Burst.Compiler.IL.Syntax.ILInstruction instruction) [0x00007] in <5365ccf18ec94235b5e31dbc5844b7eb>:0 at RobocraftX.Character.Camera.LocalCameraSphereCastEngine.LocalCameraSphereCastJob.Execute(RobocraftX.Character.Camera.LocalCameraSphereCastEngine.LocalCameraSphereCastJob* this) (at E:\RobocraftX\Assets\Code\RobocraftECS\Contexts\Scenes\Character\Camera\Engines\LocalCameraSphereCastEngine.cs:136) at Unity.Jobs.IJobExtensions.JobStruct1<RobocraftX.Character.Camera.LocalCameraSphereCastEngine.LocalCameraSphereCastJob>.Execute(ref RobocraftX.Character.Camera.LocalCameraSphereCastEngine.LocalCameraSphereCastJob data, System.IntPtr additionalPtr, System.IntPtr bufferRangePatchData, ref Unity.Jobs.LowLevel.Unsafe.JobRanges ranges, int jobIndex)
While compiling job: System.Void Unity.Jobs.IJobExtensions/JobStruct`1<RobocraftX.Character.Camera.LocalCameraSphereCastEngine/LocalCameraSphereCastJob>::Execute(T&,System.IntPtr,System.IntPtr,Unity.Jobs.LowLevel.Unsafe.JobRanges&,System.Int32)

@xoofx shall I open a bug report for this or it means something that I didn’t get it yet?

The code that breaks is this:

sphereCastEntityStruct.entityID[index++] = SveltoEgidGroup[e].egid.entityID;

where

[ReadOnly] public ComponentDataFromEntity SveltoEgidGroup;

the EGID struct is this:

[Serialization.DoNotSerialize]
[Serializable]
[StructLayout(LayoutKind.Explicit)]
public struct EGID:IEquatable,IEqualityComparer,IComparable
{
[FieldOffset(0)] public readonly uint entityID;
[FieldOffset(4)] public readonly ExclusiveGroupStruct groupID;
[FieldOffset(0)] ulong _GID;

Yes, please, that will help to reproduce and fix it more quickly.

1 Like