[SOLVED] Addressables & Async-Await [Exception]

I’m trying to async-await (C# base + plugin) on an Addressables Async operation, but am getting an error.
It’s explained in Addressables for live content management - Unite Copenhagen, that you can await on the operation returned by LoadAssetAsync. I’ve tried different variations, and all i get is following exception:

InvalidProgramException: Invalid IL code in AddressablesAsyncAwaitTest/<LoadAssetAsync>d__1:MoveNext (): IL_001f: call      0x0a000025

System.Runtime.CompilerServices.AsyncTaskMethodBuilder.Start[TStateMachine] (TStateMachine& stateMachine) (at <567df3e0919241ba98db88bec4c6696f>:0)
AddressablesAsyncAwaitTest.LoadAssetAsync () (at <0275aecbb97f45aa8ad4975a9879ead6>:0)
AddressablesAsyncAwaitTest+<Caller>d__4.MoveNext () (at Assets/AsyncAwaitTest/AddressablesAsyncAwaitTest.cs:40)
--- End of stack trace from previous location where exception was thrown ---
System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () (at <567df3e0919241ba98db88bec4c6696f>:0)
System.Runtime.CompilerServices.AsyncMethodBuilderCore+<>c.<ThrowAsync>b__6_0 (System.Object state) (at <567df3e0919241ba98db88bec4c6696f>:0)
UnityEngine.UnitySynchronizationContext+WorkRequest.Invoke () (at C:/buildslave/unity/build/Runtime/Export/Scripting/UnitySynchronizationContext.cs:150)
UnityEngine.UnitySynchronizationContext:ExecuteTasks() (at C:/buildslave/unity/build/Runtime/Export/Scripting/UnitySynchronizationContext.cs:104)

I have a clean project (U2019.2.13f1, Addressables 1.3.8 - all latest), with this script/code attached to scene GameObject:

public class AddressablesAsyncAwaitTest : MonoBehaviour
{
    [SerializeField]
    public AssetReference worldDefault;

    async Task LoadAssetAsync ()
    {
        await worldDefault.LoadAssetAsync<AssetReference>();
    }
 
    IEnumerator LoadAssetAsync2()
    {
        var asyncOperation = worldDefault.LoadAssetAsync<TextAsset>();
        yield return asyncOperation;
        Debug.Log(asyncOperation.Result)
    }

    void Start() {
        Caller();
    }

    async void Caller () {
        // example 1:
        // throws InvalidProgramException
        await LoadAssetAsync(); // <-- line 40

        // example 2:
        // using IEnumerator - works!
        //StartCoroutine (LoadAssetAsync2());
    }
}

As you can see, I’ve also included an IEnumerator example, which works as expected. The exception is only thrown using async-await.

This has also been posted in Addressables support thread here, but support there is sparse, so i’m looking for actual help among the users.

Thanks @Litovets, who found the solution here.

What follows is the re-paste:

    using System.Threading.Tasks;
    using UnityEngine;
    using UnityEngine.AddressableAssets;
     
    public class AddressablesAsyncAwaitTest : MonoBehaviour
    {
        [SerializeField]
        public AssetReference worldDefault;
     
        async Task LoadAssetAsync()
        {
            await worldDefault.LoadAssetAsync<TextAsset>().Task;
            Debug.Log("Loaded");
        }
     
        void Start()
        {
            Caller();
        }
     
        async void Caller()
        {
            await LoadAssetAsync();
        }
    }