NativeList Empty Outside Job But Not Inside It

I’m sure I’m just missing one key line of code or something since I’m new to the Jobs system, but I’ve been unable to get a NativeList out of a job.

I create a list with TempJob allocator, set it to a variable in the struct, and then assign to that variable in the job.

I’ve confirmed the list is being filled up inside the job, I have Debug.Log()s saying it’s 40-60 items long.

Once I try to get the data back out of the Job it is empty though.

I’ve also tried converting the list to an NativeArray in case it literally had to be an NativeArray to get output, but that also failed.

The code I’m using to get the output is here:

        NativeList<int2> foundPath = new NativeList<int2>(Allocator.TempJob);
        FindPathJob j = new FindPathJob
            startPosition = startPositionInt,
            endPosition = endPositionInt,
            foundPath = foundPath
        JobHandle handle = j.Schedule();
        Debug.Log("fLen: " + j.foundPath.Length);
        foundPath = j.foundPath;
        Debug.Log("count: " + foundPath.Length);

Any help?

Not sure what to think about this NativeList situation. Unlike NativeArray NativeList implements Length property as unsafeListPtr->Length and work just fine in these kind of situations. Are you 100% sure you’re not clearing, reallocating or disposing the list in any way in this job?
Also, when replacing NativeList with NativeArray be aware that int job field for buffer length is a no-no and will always show you it’s initial value (likely a 0). Buffer length can be stored, for example, in an additional NativeArray field of a length of 1.