Search Unity

Bug Player crash since Localization was integrated - "Expected to have a current operation to wait on."

Discussion in 'Localization Tools' started by Wilomomo, Nov 28, 2022.

  1. Wilomomo

    Wilomomo

    Joined:
    Jul 6, 2017
    Posts:
    6
    Hello everyone,
    I'm currently run in an issue since I integrated Localization in our project.
    So:
    I'm using Unity 2020.3.34f1 (on Windows 10), and Localization 1.4.2
    When I'm trying to run a Player version, the game crash on the splash screen.

    At the begining, I got some errors with the adressable, the error was, in player.log :
    "RuntimeData is null. Please ensure you have built the correct Player Content. Addressables - Unable to load runtime data at location".
    After some search, I follow the instructions in this posts :
    https://forum.unity.com/threads/loc...not-in-a-compiled-build.1055630/#post-6828803
    But that didn't fully fix the problem, the problem is still here, but this error gone to let place to another one
    "OperationException : Expected to have a current operation to wait on. Can not complete."

    The full logs of development build is at the end of this post

    What I've already tried
    - Build adressables
    - Clear and rebuild adressables
    - Remove "Append Filename and Hash"


    Sorry for this long post, I tried to use the "Unity Bug Reporter", but this one stay on "Uploading 100%" since an hour =/

    The full logs of development build :
    Mono path[0] = 'C:/Users/AlexandreMorize/Desktop/TestAlpha2/Voodolls_Data/Managed'
    Mono config path = 'C:/Users/AlexandreMorize/Desktop/TestAlpha2/MonoBleedingEdge/etc'
    PlayerConnection initialized from C:/Users/AlexandreMorize/Desktop/TestAlpha2/Voodolls_Data (debug = 0)
    PlayerConnection initialized network socket : 0.0.0.0 55168
    Multi-casting "[IP] 192.168.22.160 [Port] 55168 [Flags] 2 [Guid] 1322732445 [EditorId] 372925965 [Version] 1048832 [Id] WindowsPlayer(DESKTOP-03) [Debug] 0 [PackageName] WindowsPlayer [ProjectName] Voodolls" to [225.0.0.222:54997]...
    Started listening to [0.0.0.0:55168]
    PlayerConnection already initialized - listening to [0.0.0.0:55168]
    Initialize engine version: 2020.3.34f1 (9a4c9c70452b)
    [Subsystems] Discovering subsystems at path C:/Users/AlexandreMorize/Desktop/TestAlpha2/Voodolls_Data/UnitySubsystems
    GfxDevice: creating device client; threaded=1
    Direct3D:
    Version: Direct3D 11.0 [level 11.1]
    Renderer: NVIDIA GeForce RTX 3070 (ID=0x2484)
    Vendor:
    VRAM: 8043 MB
    Driver: 31.0.15.1694
    Begin MonoManager ReloadAssembly
    - Completed reload, in 0.294 seconds
    <RI> Initializing input.
    New input system (experimental) initialized
    <RI> Initialized touch support.
    The referenced script on this Behaviour (Game Object 'PersistanceSystem') is missing!
    The referenced script on this Behaviour (Game Object 'Iselin_AFAC') is missing!
    UnloadTime: 1.445300 ms
    OperationException : Expected to have a current operation to wait on. Can not complete.
    UnityEngine.StackTraceUtility:ExtractStackTrace ()
    UnityEngine.DebugLogHandler:LogFormat (UnityEngine.LogType,UnityEngine.Object,string,object[])
    UnityEngine.Logger:Log (UnityEngine.LogType,object)
    UnityEngine.Debug:LogError (object)
    UnityEngine.AddressableAssets.AddressablesImpl:LogException (UnityEngine.ResourceManagement.AsyncOperations.AsyncOperationHandle,System.Exception) (at C:/Users/AlexandreMorize/Documents/GitHub/Voodolls/Library/PackageCache/com.unity.addressables@1.20.5/Runtime/AddressablesImpl.cs:219)
    UnityEngine.ResourceManagement.AsyncOperations.AsyncOperationBase`1<UnityEngine.Localization.Settings.LocalizationSettings>:set_OperationException (System.Exception) (at C:/Users/AlexandreMorize/Documents/GitHub/Voodolls/Library/PackageCache/com.unity.addressables@1.20.5/Runtime/ResourceManager/AsyncOperations/AsyncOperationBase.cs:348)
    UnityEngine.ResourceManagement.AsyncOperations.AsyncOperationBase`1<UnityEngine.Localization.Settings.LocalizationSettings>:Complete (UnityEngine.Localization.Settings.LocalizationSettings,bool,System.Exception,bool) (at C:/Users/AlexandreMorize/Documents/GitHub/Voodolls/Library/PackageCache/com.unity.addressables@1.20.5/Runtime/ResourceManager/AsyncOperations/AsyncOperationBase.cs:488)
    UnityEngine.ResourceManagement.AsyncOperations.AsyncOperationBase`1<UnityEngine.Localization.Settings.LocalizationSettings>:Complete (UnityEngine.Localization.Settings.LocalizationSettings,bool,string,bool) (at C:/Users/AlexandreMorize/Documents/GitHub/Voodolls/Library/PackageCache/com.unity.addressables@1.20.5/Runtime/ResourceManager/AsyncOperations/AsyncOperationBase.cs:451)
    UnityEngine.ResourceManagement.AsyncOperations.AsyncOperationBase`1<UnityEngine.Localization.Settings.LocalizationSettings>:Complete (UnityEngine.Localization.Settings.LocalizationSettings,bool,string) (at C:/Users/AlexandreMorize/Documents/GitHub/Voodolls/Library/PackageCache/com.unity.addressables@1.20.5/Runtime/ResourceManager/AsyncOperations/AsyncOperationBase.cs:435)
    UnityEngine.Localization.Operations.WaitForCurrentOperationAsyncOperationBase`1<UnityEngine.Localization.Settings.LocalizationSettings>:InvokeWaitForCompletion () (at C:/Users/AlexandreMorize/Documents/GitHub/Voodolls/Library/PackageCache/com.unity.localization@1.4.2/Runtime/Operations/WaitForCurrentOperationAsyncOperationBase.cs:40)
    UnityEngine.ResourceManagement.AsyncOperations.AsyncOperationBase`1<UnityEngine.Localization.Settings.LocalizationSettings>:WaitForCompletion () (at C:/Users/AlexandreMorize/Documents/GitHub/Voodolls/Library/PackageCache/com.unity.addressables@1.20.5/Runtime/ResourceManager/AsyncOperations/AsyncOperationBase.cs:172)
    UnityEngine.ResourceManagement.AsyncOperations.AsyncOperationHandle:WaitForCompletion () (at C:/Users/AlexandreMorize/Documents/GitHub/Voodolls/Library/PackageCache/com.unity.addressables@1.20.5/Runtime/ResourceManager/AsyncOperations/AsyncOperationHandle.cs:592)
    UnityEngine.Localization.Operations.WaitForCurrentOperationAsyncOperationBase`1<UnityEngine.Localization.Tables.StringTable>:InvokeWaitForCompletion () (at C:/Users/AlexandreMorize/Documents/GitHub/Voodolls/Library/PackageCache/com.unity.localization@1.4.2/Runtime/Operations/WaitForCurrentOperationAsyncOperationBase.cs:32)
    UnityEngine.ResourceManagement.AsyncOperations.AsyncOperationBase`1<UnityEngine.Localization.Tables.StringTable>:WaitForCompletion () (at C:/Users/AlexandreMorize/Documents/GitHub/Voodolls/Library/PackageCache/com.unity.addressables@1.20.5/Runtime/ResourceManager/AsyncOperations/AsyncOperationBase.cs:172)
    UnityEngine.ResourceManagement.AsyncOperations.AsyncOperationHandle:WaitForCompletion () (at C:/Users/AlexandreMorize/Documents/GitHub/Voodolls/Library/PackageCache/com.unity.addressables@1.20.5/Runtime/ResourceManager/AsyncOperations/AsyncOperationHandle.cs:592)
    UnityEngine.Localization.Operations.WaitForCurrentOperationAsyncOperationBase`1<UnityEngine.Localization.Settings.LocalizedDatabase`2/TableEntryResult<UnityEngine.Localization.Tables.StringTable, UnityEngine.Localization.Tables.StringTableEntry>>:InvokeWaitForCompletion () (at C:/Users/AlexandreMorize/Documents/GitHub/Voodolls/Library/PackageCache/com.unity.localization@1.4.2/Runtime/Operations/WaitForCurrentOperationAsyncOperationBase.cs:32)
    UnityEngine.ResourceManagement.AsyncOperations.AsyncOperationBase`1<UnityEngine.Localization.Settings.LocalizedDatabase`2/TableEntryResult<UnityEngine.Localization.Tables.StringTable, UnityEngine.Localization.Tables.StringTableEntry>>:WaitForCompletion () (at C:/Users/AlexandreMorize/Documents/GitHub/Voodolls/Library/PackageCache/com.unity.addressables@1.20.5/Runtime/ResourceManager/AsyncOperations/AsyncOperationBase.cs:172)
    UnityEngine.ResourceManagement.AsyncOperations.AsyncOperationHandle:WaitForCompletion () (at C:/Users/AlexandreMorize/Documents/GitHub/Voodolls/Library/PackageCache/com.unity.addressables@1.20.5/Runtime/ResourceManager/AsyncOperations/AsyncOperationHandle.cs:592)
    UnityEngine.Localization.Operations.WaitForCurrentOperationAsyncOperationBase`1<string>:InvokeWaitForCompletion () (at C:/Users/AlexandreMorize/Documents/GitHub/Voodolls/Library/PackageCache/com.unity.localization@1.4.2/Runtime/Operations/WaitForCurrentOperationAsyncOperationBase.cs:32)
    UnityEngine.ResourceManagement.AsyncOperations.AsyncOperationBase`1<string>:WaitForCompletion () (at C:/Users/AlexandreMorize/Documents/GitHub/Voodolls/Library/PackageCache/com.unity.addressables@1.20.5/Runtime/ResourceManager/AsyncOperations/AsyncOperationBase.cs:172)
    UnityEngine.ResourceManagement.AsyncOperations.AsyncOperationHandle`1<string>:WaitForCompletion () (at C:/Users/AlexandreMorize/Documents/GitHub/Voodolls/Library/PackageCache/com.unity.addressables@1.20.5/Runtime/ResourceManager/AsyncOperations/AsyncOperationHandle.cs:188)
    UnityEngine.Localization.LocalizedString:GetLocalizedString () (at C:/Users/AlexandreMorize/Documents/GitHub/Voodolls/Library/PackageCache/com.unity.localization@1.4.2/Runtime/Localized Reference/LocalizedString.cs:273)
    LocalizeUIText:Awake () (at C:/Users/AlexandreMorize/Documents/GitHub/Voodolls/Assets/Scripts/UI/LocalizeUIText.cs:21)
    (Filename: C:/Users/AlexandreMorize/Documents/GitHub/Voodolls/Library/PackageCache/com.unity.addressables@1.20.5/Runtime/AddressablesImpl.cs Line: 219)
     
  2. karl_jones

    karl_jones

    Unity Technologies

    Joined:
    May 5, 2015
    Posts:
    8,292
    I have seen another user post this issue. Are you able to file a bug report? They were unable to reproduce it so we still dont know what the cause is.
    The solution that worked for them was to call GetLocalizedStringAsync instead of GetLocalizedString.
     
  3. Wilomomo

    Wilomomo

    Joined:
    Jul 6, 2017
    Posts:
    6
    Yesterday, I was unable to...
    I'll try today from another PC

    I'll try with GetLocalizedStringAsync too, I'll give you more feedback asap =)
     
    karl_jones likes this.
  4. Bumpalump

    Bumpalump

    Joined:
    Dec 26, 2020
    Posts:
    13
    Also having crash with newest 1.4.2 version of Localization. In editor everything looks ok but crashes in build.
    Downgraded to 1.3.2 and all works normally.
    Using unity 2021.3.3f.
     
  5. karl_jones

    karl_jones

    Unity Technologies

    Joined:
    May 5, 2015
    Posts:
    8,292
    Could you please file a bug report?
     
  6. Bumpalump

    Bumpalump

    Joined:
    Dec 26, 2020
    Posts:
    13
    What would be proper procedure for that? Do I post it here on forums or some other method? Also which logs do you need? I can do a quick install of 1.4.2 and reproduce the crash easily - it happens each time with this version but only in build, not in editor.
     
  7. karl_jones

    karl_jones

    Unity Technologies

    Joined:
    May 5, 2015
    Posts:
    8,292
    Please follow this process https://unity3d.com/unity/qa/bug-reporting
     
  8. frank-ijsfontein

    frank-ijsfontein

    Joined:
    Sep 11, 2015
    Posts:
    16
    I had to do this in my initialization script:

    Code (CSharp):
    1. if (!LocalizationSettings.InitializeSynchronously)
    2. {
    3.     LocalizationSettings.InitializationOperation.WaitForCompletion();
    4. }
    to avoid the error mentioned in the subject of this thread.

    In the Editor I didn't get the error, only in a build. I have InitializeSynchronously set to true so actually there's no InitializationOperation to wait for, I guess.
    This is in Unity 2022.1.23, using Localization 1.4.2
     
    dtaddis and sergeypchelintsev90 like this.
  9. karl_jones

    karl_jones

    Unity Technologies

    Joined:
    May 5, 2015
    Posts:
    8,292
    Could you please file a bug report so we can figure out why you need to do this?
     
  10. Knipsch

    Knipsch

    Joined:
    Sep 12, 2018
    Posts:
    7
    I got the same error today, and downgrading Localization to version 1.3.2 fixed it for me.
     
  11. karl_jones

    karl_jones

    Unity Technologies

    Joined:
    May 5, 2015
    Posts:
    8,292
    Are you able to file a bug report with the project or a sample project that shows the issue?
     
  12. Knipsch

    Knipsch

    Joined:
    Sep 12, 2018
    Posts:
    7
    Yep, just submitted one. Do you need any info from me to make it easier for you to find that bug report?
     
    karl_jones likes this.
  13. dlorre

    dlorre

    Joined:
    Apr 12, 2020
    Posts:
    699
    I have this error message while testing on my laptop which is much slower than my dev computer. I have no reference to localization in logs but I googled the message and found this thread.
     
  14. karl_jones

    karl_jones

    Unity Technologies

    Joined:
    May 5, 2015
    Posts:
    8,292
    Do you have the bug number?
     
  15. Knipsch

    Knipsch

    Joined:
    Sep 12, 2018
    Posts:
    7
    It seems to be IN-25823.
     
    karl_jones likes this.
  16. forestrf

    forestrf

    Joined:
    Aug 28, 2010
    Posts:
    231
    I also got this problem and was able to make a small repro scene with close to the minimum code required for it.
    I think it's related to loading synchronously a translation and it being the first translation ever loaded since the game started.

    Case: CASE IN-26684

    Also it seems there's no locale chosen on the editor until the Play button is pressed, this is annoying when working with translations inside the editor as they seem to not work until then.
    Included in the repro scene there's this mod I made which I like more than the default as it's less intrusive in the game view.
    upload_2022-12-22_4-6-26.png

    Edit: Using GetLocalizedStringAsync doesn't seem to work if instead of using the event "Completed" I store the AsyncOperationHandle and use .IsDone and .Result when I'm ready to use it.
    I don't know what it's the real problem but at least it seems to fail every time, so it should be a good repro case.
     
    Last edited: Dec 22, 2022
    karl_jones likes this.
  17. EduardoSeitz

    EduardoSeitz

    Joined:
    May 11, 2019
    Posts:
    4
    I also had this same error in Unity 2021.3.1 personal, it only happens on physical android devices and not in the editor. Fixed it by changing the line in the manifest.json from "com.unity.localization": "1.4.2" to "com.unity.localization": "1.4.0-exp.1".
     
  18. EduardoSeitz

    EduardoSeitz

    Joined:
    May 11, 2019
    Posts:
    4
    The exact error I was getting is:
    2023/01/03 20:46:46.880 7032 7109 Error Unity OperationException : Expected to have a current operation to wait on. Can not complete.
     
  19. karl_jones

    karl_jones

    Unity Technologies

    Joined:
    May 5, 2015
    Posts:
    8,292
    It was likely fixed by one of the bug fixes in 1.4.2.
     
  20. hwibaek2827

    hwibaek2827

    Joined:
    May 2, 2022
    Posts:
    3
    The bug still hasn't been fixed in 1.4.2
     
  21. karl_jones

    karl_jones

    Unity Technologies

    Joined:
    May 5, 2015
    Posts:
    8,292
    Could you please file a bug report?
     
  22. hwibaek2827

    hwibaek2827

    Joined:
    May 2, 2022
    Posts:
    3
    I sended
     
    karl_jones likes this.
  23. LazloBonin

    LazloBonin

    Joined:
    Mar 6, 2015
    Posts:
    813
    Can confirm I'm still getting this hang in the player only.

    Localization 1.4.2
    Unity 2020.3.43f1
     
  24. karl_jones

    karl_jones

    Unity Technologies

    Joined:
    May 5, 2015
    Posts:
    8,292
    Do you have the bug number? Nothing has come through to us yet, it could be stuck with QA.
     
  25. LazloBonin

    LazloBonin

    Joined:
    Mar 6, 2015
    Posts:
    813
    After more experimentation, I think this was caused by the adressables data being corrupt. I deleted the AdressablesData folder, rebuilt it, ran the analyzer, etc., and now that error message is gone and the build runs fine.
     
    karl_jones likes this.
  26. LazloBonin

    LazloBonin

    Joined:
    Mar 6, 2015
    Posts:
    813
    Apologies, I spoke too fast; it only fixed the hang because I hadn't actually built the addressables for the player, thus the locales were null in game and the hang was presumably moot because it failed earlier in the chain. The issue is indeed still present now that I have built the addressables.

    However, as indicated by another reporter, reverting to 1.3.2 fixes it, so it seems the regression happened between these two versions. I did not personally test 1.4.0-exp.1 as I prefer sticking to stable releases.
     
  27. karl_jones

    karl_jones

    Unity Technologies

    Joined:
    May 5, 2015
    Posts:
    8,292
    Could you please file a bug report? https://unity.com/releases/editor/qa/bug-reporting
     
  28. HexSine

    HexSine

    Joined:
    Oct 1, 2017
    Posts:
    3
    I was running into this problem as well,

    In this example "localizedName.Value" is a LocalizedString.

    Using LocolizedString.GetLocalizedStringAsync() failed
    Code (CSharp):
    1.  
    2. var operation = localizedName.Value.GetLocalizedStringAsync();
    3. operation.WaitForCompletion();
    4. m_dialog.Name = operation.Result;
    But using LocalizationSettings.StringDatabase.GetLocalizedStringAsync(TableReference, TableReferenceEntry, Locale);
    worked fine.

    Code (CSharp):
    1.  
    2. Locale locale = LocalizationSettings.SelectedLocale;
    3. var operation = LocalizationSettings.StringDatabase.GetLocalizedStringAsync(localizedName.Value.TableReference,localizedName.Value.TableEntryReference, locale);
    4. operation.WaitForCompletion();
    5. m_dialog.Name = operation.Result;
    I'll try and file a bug report when I have the time to setup a project for it but maybe this will work as a workaround for someone else in the meantime?
     
  29. karl_jones

    karl_jones

    Unity Technologies

    Joined:
    May 5, 2015
    Posts:
    8,292
    Are you using the latest version 1.4.3?
     
  30. HexSine

    HexSine

    Joined:
    Oct 1, 2017
    Posts:
    3
    Oh I was on 1.4.2, In the package manager I didn't see an option to update to 1.4.3, only to downgrade to 1.3.2. I accidentally downgraded and don't know the proper way to select a package version... do I just edit the version number in the manifests dependencies and restart?
    If that is the correct way of doing it I edited the manifest to 1.4.3, and wasn't able to reproduce it no matter what I tried. I then edited it back to 1.4.2 and now also can't reproduce the bug in 1.4.2 anymore so I don't know whats up anymore.
     
  31. karl_jones

    karl_jones

    Unity Technologies

    Joined:
    May 5, 2015
    Posts:
    8,292
    Yes editing the manifest is the way if it's not visible in the package manager. 1.4.3 has a few extra bug fixes. If the issue happens again please file a bug report.
     
  32. Katsu_Neko

    Katsu_Neko

    Joined:
    Oct 18, 2017
    Posts:
    2
    I got the same error on Unity 2020.3.29f1 and Localization 1.4.3.
    Then I downgraded Localization to 1.3.2 just like #10 did and it fixed for me too!
     
  33. karl_jones

    karl_jones

    Unity Technologies

    Joined:
    May 5, 2015
    Posts:
    8,292
  34. Katsu_Neko

    Katsu_Neko

    Joined:
    Oct 18, 2017
    Posts:
    2
    I reproduced the issue in a new project and filed a bug report (IN-39058).
    Hope the sample attached can helps you.
     
    karl_jones likes this.
  35. sergeypchelintsev90

    sergeypchelintsev90

    Joined:
    Jul 20, 2022
    Posts:
    1
    It's helped me with 1.4.3. Thanks!
     
    karl_jones likes this.
  36. OneManEscapePlan

    OneManEscapePlan

    Joined:
    Oct 14, 2015
    Posts:
    222
    We also encountered this issue with 1.4.3 on Unity 2021.3.23f1; the app would freeze and then crash on iOS, but ran fine in the Editor. As others have noted, downgrading to the recommended version 1.3.2 fixes the issue.
     
  37. karl_jones

    karl_jones

    Unity Technologies

    Joined:
    May 5, 2015
    Posts:
    8,292
    Are you able to fille a bug report so we can look it?
     
  38. dlorre

    dlorre

    Joined:
    Apr 12, 2020
    Posts:
    699
    I think this bug is difficult to narrow down because it depends on the computer performance, it will be more likely to occur on a very slow computer.
     
  39. karl_jones

    karl_jones

    Unity Technologies

    Joined:
    May 5, 2015
    Posts:
    8,292
    Hi,
    I'm fairly certain we have identified the cause of this issue now. The problem is our initialization code is not waiting for addressables to initialize which causes the invalid handle errors, the dependency was not setup correctly. We have a fix on the way, for now you can call Addressable.InitializeAsync and wait for it to complete before doing anything with localization.
     
  40. flippi273

    flippi273

    Joined:
    Nov 17, 2018
    Posts:
    24
    We had this same issue on Localization 1.4.3. After updating to 1.4.5 the issue was resolved!
     
    karl_jones likes this.