Burst 1.1.2 error on native method

Works fine without burst. The IntPtr is not zero.

This is the interop signature in case it helps.

[SuppressUnmanagedCodeSecurity]
[DllImport(NativeLibrary, EntryPoint = "QueryGetRandomPosition", CallingConvention = CallingConvention.Cdecl)]
public static extern int GetRandomPosition(IntPtr aiQuery, out float3 result);

Unexpected exception Burst.Compiler.IL.CompilerException: Missing external function name: #dllimport:C:\Games\aigame\AiNav\x64\Release\AiNav.dll|QueryGetRandomPosition => method: AiNav.Navigation.Query.GetRandomPosition(System.IntPtr aiQuery, ref Unity.Mathematics.float3 result)_DFB76F9F3726AB57. Reason: Function pointer cannot be IntPtr.Zero

at Burst.Compiler.IL.Jit.JitCompiler.CompileMethodInternal (Burst.Compiler.IL.Jit.JitCompiler+CachedMethodValue currentMethodValue, Mono.Cecil.MethodReference methodReference, Burst.Compiler.IL.Jit.JitOptions jitOptions) [0x00542] in <3179d4839c86430ca331f2949f40ede5>:0
at Burst.Compiler.IL.Jit.JitCompiler.CompileMethod (Mono.Cecil.MethodReference methodReference, Burst.Compiler.IL.Jit.JitOptions jitOptions) [0x0006b] in <3179d4839c86430ca331f2949f40ede5>:0
at Burst.Compiler.IL.Jit.JitCompilerService.Compile (Burst.Compiler.IL.Jit.JitCompilerService+CompileJob job) [0x002ce] in <3179d4839c86430ca331f2949f40ede5>:0

While compiling job: System.Void Unity.Entities.JobForEachExtensions/JobStruct_Process_C2<AiNav.AiNavTestSystem/MoveAgentsJob,AiNav.AiNavAgent>::Execute(Unity.Entities.JobForEachExtensions/JobStruct_Process_C2<T,T0>&,System.IntPtr,System.IntPtr,Unity.Jobs.LowLevel.Unsafe.JobRanges&,System.Int32)

Bit of a dated version of burst (5 months, 12 releases though they are preview but they are mostly bug fixes.)

Have you tried 1.2+ yet? Not saying it will be fixed but should check at least.

Ya worth a shot I was having consistent issues with a couple of previews in a row so I just stopped using them but that’s been a while.

Latest preview still the same error.

The new rule of not passing structs by value threw me for a loop though. At first I thought ok that means non burst code needs a different path, but it doesn’t. The .net runtime also passes a ref blittable struct by value when the native signature wants a value.