Search Unity

Invalid IL code

Discussion in 'Addressables' started by xKosta, Jul 10, 2019.

  1. xKosta

    xKosta

    Joined:
    Oct 15, 2014
    Posts:
    22
    Hey, I encounter following issue during my work with Addressables.

    Code (CSharp):
    1. InvalidProgramException: Invalid IL code in [...]/<NothingAsync>d__12:MoveNext (): IL_001c: call      0x0a000315
    2. System.Runtime.CompilerServices.AsyncTaskMethodBuilder.Start[TStateMachine] (TStateMachine& stateMachine) (at <7d97106330684add86d080ecf65bfe69>:0)
    3. [...].NothingAsync () (at <e7100c1aed3a4fd79d4d8d0cb33b90bc>:0)
    4. [...]+<[...]r>d__7.MoveNext () (at [...]:49)
    5. --- End of stack trace from previous location where exception was thrown ---
    6. System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () (at <7d97106330684add86d080ecf65bfe69>:0)
    7. System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess (System.Threading.Tasks.Task task) (at <7d97106330684add86d080ecf65bfe69>:0)
    8. System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (System.Threading.Tasks.Task task) (at <7d97106330684add86d080ecf65bfe69>:0)
    9. System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd (System.Threading.Tasks.Task task) (at <7d97106330684add86d080ecf65bfe69>:0)
    10. System.Runtime.CompilerServices.TaskAwaiter.GetResult () (at <7d97106330684add86d080ecf65bfe69>:0)
    I am using async and await to instantiate the assets. With version 0.8.6 it worked well until I added many assets and groups. Then this error occured and I tried to fix with an update to 1.1.4.
    I still have no clue how to fix it or what causes it, this is how my code looks like and also with an interesting workaround, maybe this gives a clue what is wrong. See the attached image.

    I know that Addressables is not production ready, so this just my experience and maybe someone can use for something.
     

    Attached Files:

  2. austriahaniel

    austriahaniel

    Joined:
    May 3, 2019
    Posts:
    5
    Have you tried with..

    Code (CSharp):
    1. var gameObj = await Addressables.InstantiateAsync("key").Task;
     
  3. xKosta

    xKosta

    Joined:
    Oct 15, 2014
    Posts:
    22
    Yes, I did, but with no luck. As soon as I write the "Addressables.InstantiateAsync" Line and go to playmode, the above described error occures. It is also not possible to debug this.
     
  4. xKosta

    xKosta

    Joined:
    Oct 15, 2014
    Posts:
    22
    I have to take the last reply back, either it works with Task at the end or it is the new Unity 2019.1.10 version or both, now it works and I am very surprised.
     
    unity_bill likes this.
  5. LCLx

    LCLx

    Joined:
    Jul 5, 2019
    Posts:
    1
    I found that where is something wrong with System.Runtime.CompilerServices.Unsafe.dll which is provided by com.unity.collection. I place a newer version of that dll and the problem solved. But every time I open unity, the appliction would change that automatically. So I have to replace that every time I use that. This is definitly a bug, hope unity will update their plugin soon.
     
unityunity