Search Unity

Argument Exception on Windows IL2CPP build with Burst & Jobs

Discussion in 'Burst' started by torano, Feb 26, 2020.

  1. torano

    torano

    Joined:
    Apr 7, 2017
    Posts:
    46
    My project works properly in the editor and on Mono build, but on IL2CPP build I get the error below in the Player log file.Unity editor says it successfully built and I can play it but Jobs seem not to be working.


    ArgumentException: Object contains non-primitive or non-blittable data.
    at Unity.Collections.NativeArray`1[T].Copy (Unity.Collections.NativeArray`1[T] src, System.Int32 srcIndex, T[] dst, System.Int32 dstIndex, System.Int32 length) [0x00000] in <00000000000000000000000000000000>:0
    at Unity.Collections.NativeArray`1[T].Copy (Unity.Collections.NativeArray`1[T] src, T[] dst) [0x00000] in <00000000000000000000000000000000>:0
    at Unity.Collections.NativeArray`1[T].Allocate (System.Int32 length, Unity.Collections.Allocator allocator, Unity.Collections.NativeArray`1[T]& array) [0x00000] in <00000000000000000000000000000000>:0
    at UniBvhBuilder.Builder.BvhBuilderBase.OnCompleteInitializeJob () [0x00000] in <00000000000000000000000000000000>:0
    at UniBvhBuilder.Builder.BvhBuilderBase.CompleteUpdateBvh () [0x00000] in <00000000000000000000000000000000>:0
    at UniBvhBuilder.Core.BvhObject.<Awake>b__26_3 (UniRx.Unit _) [0x00000] in <00000000000000000000000000000000>:0
    at System.Action`1[T].Invoke (T obj) [0x00000] in <00000000000000000000000000000000>:0
    at UniRx.Operators.WhereObservable`1+Where[T].OnNext (T value) [0x00000] in <00000000000000000000000000000000>:0
    at UniRx.Subject`1[T].OnNext (T value) [0x00000] in <00000000000000000000000000000000>:0
    at UniRx.Triggers.ObservableLateUpdateTrigger.LateUpdate () [0x00000] in <00000000000000000000000000000000>:0

    (Filename: currently not available on il2cpp Line: -1)

    In OnCompleteInitializeJob I do dispose completed jobs and copy NativeArrays to arrays. I thought jobs disposed there has some problems with Burst so I tried removing [BurstCompile] from these jobs but nothing has changed.

    I am not sure if this is related, but I also get the warnings in the editor console after I built the project successfully.

    Unable to find player assembly: D:\ToranoFolders\UnityProjects\UniBvhBuilder\Temp\StagingArea\Data\Managed\UnityEngine.TestRunner.dll

    Unable to find player assembly: D:\ToranoFolders\UnityProjects\UniBvhBuilder\Temp\StagingArea\Data\Managed\Unity.PerformanceTesting.dll

    Could anyone help me solve this issue?

    I use Unity 2019.3.0f9, Burst 1.2.3 and Jobs 0.2.5 preview 20. also tried Burst 1.3.0 preview 3 but not work.
     
    Last edited: Feb 26, 2020
  2. Arowx

    Arowx

    Joined:
    Nov 12, 2009
    Posts:
    8,194
    I've seen this before it happened when I tried to have a data component with an array in it, do any of your components contain collections arrays/lists etc?
     
  3. torano

    torano

    Joined:
    Apr 7, 2017
    Posts:
    46
    Thanks for your replying.

    I use MonoBehaviour, not ECS, with Jobs, and in any jobs I do not use arrays except NativeArray, NativeQueue, and NativeList.

    I found a NativeArray of a struct which has bool is used in a job. But I think Burst supports bool, though I think it is non-blittable data.

    In the function which throws the error some jobs are disposed, and I don't know exactly which job has a problem. I will try to figure out later and show the code here.
     
  4. tertle

    tertle

    Joined:
    Jan 25, 2011
    Posts:
    3,761
    We found recently that bools sometimes seemingly randomly fail blittable checks with IL2CPP (this was for xbox, but based of this I assume it's windows as well.)
     
    _geo__, d11ldawson and nekelund_unity like this.
  5. torano

    torano

    Joined:
    Apr 7, 2017
    Posts:
    46
    As @tertle said, IL2CPP and Burst together may have issues with bools. I always got errors with bool variables.

    Changing bool fields to int fields fixed my problem. Thanks!
     
    nekelund_unity and yufeng_issac like this.
  6. yufeng_issac

    yufeng_issac

    Joined:
    Jun 11, 2019
    Posts:
    2
    Got the same issue.
    Thanks.