Search Unity

[bug] possible bad IResourceLocation.Hash

Discussion in 'Addressables' started by nik_d, Jun 19, 2019.

  1. nik_d

    nik_d

    Joined:
    Apr 27, 2018
    Posts:
    66
    The crash from production environment (just dozens for millions, but don't like it in any case) - from Fabric's Crashlytics:

    Code (CSharp):
    1. InvalidCastException : Unable to cast object of type 'ProviderOperation`1' to type 'AsyncOperationBase`1'.
    2. UnityEngine.ResourceManagement.AsyncOperations.AsyncOperationHandle`1[TObject].op_Implicit (UnityEngine.ResourceManagement.AsyncOperations.AsyncOperationHandle`1[TObject])
    3. UnityEngine.ResourceManagement.ResourceManager.ProvideResource[TObject] (UnityEngine.ResourceManagement.ResourceManager)
    4. UnityEngine.AddressableAssets.AddressablesImpl.LoadAssetAsync[TObject] (UnityEngine.AddressableAssets.AddressablesImpl)
    5. UnityEngine.AddressableAssets.Addressables.LoadAssetAsync[TObject] (UnityEngine.AddressableAssets.Addressables)
    6. Address.AddressablesExt.LoadAssetAsync[T] (Address.AddressablesExt)
    I could not repeat it externally but found the only way to reproduce the same exception/callstack - to fake
    m_AssetOperationCache.TryGetValue returns op for different type.

    So just decided to strengthen cache checking in ResourceManager.ProvideResource() for now:
    Code (CSharp):
    1.             if (m_AssetOperationCache.TryGetValue(hash, out op)
    2.                 //**addressables: possible bugfix: by Crashlytics: "InvalidCastException : Unable to cast object of type 'ProviderOperation`1' to type 'AsyncOperationBase`1'." in ProvideResource()
    3.                 && op.ResultType == desiredType)
    4.  
    (to see in next release: whether CreateOperation() will fail with m_AssetOperationCache.Add =))
     
    Last edited: Jun 19, 2019
    unity_bill likes this.
  2. melissae

    melissae

    Unity Technologies

    Joined:
    Dec 5, 2018
    Posts:
    9
    Due to other priorities we will not be addressing this issue at this time.
     
  3. phobos2077

    phobos2077

    Joined:
    Feb 10, 2018
    Posts:
    350
    @DavidUnity3d was this eventually fixed or still being ignored?

    We are getting occasional InvalidCastException that looks awfully close to this error. Loading the same addressable assets on game load exactly the same way, SOMETIMES we get this exception. Looks like a hash collision or some kind of race condition some where.

    We are using Addressables 1.16.1 at the moment.
     
  4. TreyK-47

    TreyK-47

    Unity Technologies

    Joined:
    Oct 22, 2019
    Posts:
    1,822
    Let me see if I can chase down the status of this one.
     
    phobos2077 likes this.
  5. davidla_unity

    davidla_unity

    Unity Technologies

    Joined:
    Nov 17, 2016
    Posts:
    763
    @phobos2077 it's not on our radar currently. That's really awkward that you only get the error sometimes. If you have a project that you could submit in a bug report that somewhat reliably reproduces the issue we can take a look.
     
    phobos2077 likes this.