Hard crash on Android device, no errors in adb

I tried calling Addressables.LoadAssetsAsync from a static class (not a Monobehaviour/singleton) like this:

public static async Task<bool> FetchPlayerProfiles(string assetLabel)
{
    var fetchOp = Addressables.LoadAssetsAsync<PlayerProfile>(new List<object> {assetLabel}, null, Addressables.MergeMode.None);

    if (!fetchOp.IsValid())
    {
       Debug.LogWarning($"[{assetLabel}] is not a valid asset operation key.");

       Addressables.Release(fetchOp);

       return false;
    }

    await fetchOp.Task;

    if (fetchOp.Status == AsyncOperationStatus.Failed)
    {
       Debug.LogException(biomeFetchOp.OperationException);

       Addressables.Release(fetchOp);

       return false;
    }

    if (fetchOp.Result == null)
    {
        Debug.LogWarning("Fetched asset list is null!");

        Addressables.Release(fetchOp);

        return false;
    }

    currentProfiles = new List<PlayerProfile>(fetchOp.Result.OrderBy(profile => profile.id));

    return true;
}

And hot damn it did not like that one bit. Hard crash, no errors, just completely locks up. I guess you can’t do this? I’m very new to async/await as well so I might be getting something about that wrong…

I’m using
Addressables 1.9
Unity 2019.3.4f1

Have you tried upgrading to a new version of Addressables to see if this still happens? If the issue persists, please file a but report for us. :slight_smile:

I’ll bring it up to 1.12 some time soon and see if it does the same thing.

Are you sure you are not basically locking up the main thread by awaiting there?

The whole point of await is to not block the main thread, so that in itself should not be the cause. I don’t see anything wrong with OP’s code.

Yes, that is the point of it, but it depends on what synchronisation context it was run from.