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

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 :

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
    Initializing input.
    New input system (experimental) initialized
    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.AsyncOperationBase1<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.AsyncOperationBase1<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.AsyncOperationBase1<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.AsyncOperationBase1<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.WaitForCurrentOperationAsyncOperationBase1<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.AsyncOperationBase1<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.WaitForCurrentOperationAsyncOperationBase1<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.AsyncOperationBase1<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.WaitForCurrentOperationAsyncOperationBase1<UnityEngine.Localization.Settings.LocalizedDatabase2/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.AsyncOperationBase1<UnityEngine.Localization.Settings.LocalizedDatabase2/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.WaitForCurrentOperationAsyncOperationBase1<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.AsyncOperationBase1: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: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)

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.

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 =)

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.

Could you please file a bug report?

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.

Please follow this process https://unity3d.com/unity/qa/bug-reporting

I had to do this in my initialization script:

if (!LocalizationSettings.InitializeSynchronously)
{
    LocalizationSettings.InitializationOperation.WaitForCompletion();
}

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

Could you please file a bug report so we can figure out why you need to do this?

I got the same error today, and downgrading Localization to version 1.3.2 fixed it for me.

Are you able to file a bug report with the project or a sample project that shows the issue?

Yep, just submitted one. Do you need any info from me to make it easier for you to find that bug report?

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.

Do you have the bug number?

It seems to be IN-25823.

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.
8679774--1170000--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.

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”.

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.

It was likely fixed by one of the bug fixes in 1.4.2.

The bug still hasn’t been fixed in 1.4.2