Testing NativeQueue.ParallelWriter with another bug (already reported) I have encountered another issue when trying to stack jobs with the same queue. When using it without the ParallelWriter (IJob, for example) I can stack two operations without any issue. As soon as converter to the ParallelWriter version (with IJobParallelFor in my case) this error message pops:
InvalidOperationException: The previously scheduled job RepoCode:EnqueueSingle writes to the NativeArray EnqueueSingle.Queue. You must call JobHandle.Complete() on the job RepoCode:EnqueueSingle, before you can write to the NativeArray safely.
I have an isolated cases submitted with case number 1175406.
Thanks for this @tertle ! I don’t know that and you learn me an useful trick, I was blocked by that many times and the doc or error messages don’t help …
Yes, I’m scheduling the previews job before calling AsParallelWriter for the next. Caching the ParallelWriter version or schedule all jobs after will “fix” the issue. Thanks for the tip.
Unfortunately this behaviour differs from other parallel containers, NativeMultiHashMap more specifically, so I wasn’t sure if it’s a bug or limitation.