Exception: Cannot increment reference count on operation GetLocalizedStringOperation

Hi, I have a problem when I first open the app and it loads localization. When the scene loads for the first time, the text that has the localization does not change to the currently active language.

Editors and plugins I use:
- Unity 2020.3.40f1
- Localization 1.4.4
- Addressables 1.21.8

First error log:
[quote]
InvalidOperationException: Trying to release an object that has already been released to the pool.
UnityEngine.Pool.ObjectPool1[T].Release (T element) (at Library/PackageCache/com.unity.localization@1.4.4/Runtime/Utilities/ObjectPool/ObjectPools.cs:115)
UnityEngine.Pool.GenericPool
1[T].Release (T toRelease) (at Library/PackageCache/com.unity.localization@1.4.4/Runtime/Utilities/ObjectPool/GenericPool.cs:32)
UnityEngine.Localization.Operations.GetLocalizedStringOperation.Destroy () (at Library/PackageCache/com.unity.localization@1.4.4/Runtime/Operations/GetLocalizedStringOperation.cs:88)
UnityEngine.ResourceManagement.AsyncOperations.AsyncOperationBase1[TObject].DecrementReferenceCount () (at Library/PackageCache/com.unity.addressables@1.21.8/Runtime/ResourceManager/AsyncOperations/AsyncOperationBase.cs:229)
UnityEngine.ResourceManagement.AsyncOperations.AsyncOperationBase
1[TObject].UnityEngine.ResourceManagement.AsyncOperations.IAsyncOperation.DecrementReferenceCount () (at Library/PackageCache/com.unity.addressables@1.21.8/Runtime/ResourceManager/AsyncOperations/AsyncOperationBase.cs:589)
UnityEngine.ResourceManagement.AsyncOperations.AsyncOperationHandle.Release () (at Library/PackageCache/com.unity.addressables@1.21.8/Runtime/ResourceManager/AsyncOperations/AsyncOperationHandle.cs:532)
UnityEngine.ResourceManagement.ResourceManager.Release (UnityEngine.ResourceManagement.AsyncOperations.AsyncOperationHandle handle) (at Library/PackageCache/com.unity.addressables@1.21.8/Runtime/ResourceManager/ResourceManager.cs:710)
UnityEngine.AddressableAssets.AddressablesImpl.Release (UnityEngine.ResourceManagement.AsyncOperations.AsyncOperationHandle handle) (at Library/PackageCache/com.unity.addressables@1.21.8/Runtime/AddressablesImpl.cs:835)
UnityEngine.AddressableAssets.Addressables.Release (UnityEngine.ResourceManagement.AsyncOperations.AsyncOperationHandle handle) (at Library/PackageCache/com.unity.addressables@1.21.8/Runtime/Addressables.cs:1445)
UnityEngine.Localization.AddressablesInterface.ReleaseInternal (UnityEngine.ResourceManagement.AsyncOperations.AsyncOperationHandle handle) (at Library/PackageCache/com.unity.localization@1.4.4/Runtime/Addressables/AddressablesInterface.cs:82)
UnityEngine.Localization.AddressablesInterface.SafeRelease (UnityEngine.ResourceManagement.AsyncOperations.AsyncOperationHandle handle) (at Library/PackageCache/com.unity.localization@1.4.4/Runtime/Addressables/AddressablesInterface.cs:47)
UnityEngine.Localization.LocalizationBehaviour.LateUpdate () (at Library/PackageCache/com.unity.localization@1.4.4/Runtime/Utilities/LocalizationBehaviour.cs:32)
[/quote]

Then if you open the TMP UI which contains Localization, an error like this will appear:
[quote]
Exception: Cannot increment reference count on operation GetLocalizedStringOperation, Locale: Chinese (Simplified) (zh), Table: TableReference(ee0e0481-35c1-c304-3ad9-572aa17a02e3 - app), Entry: TableEntryReference(4666258525081600) because it has already been destroyed

UnityEngine.ResourceManagement.AsyncOperations.AsyncOperationBase`1[TObject].IncrementReferenceCount() (at Library/PackageCache/com.unity.addressables@1.21.17/Runtime/ResourceManager/AsyncOperations/AsyncOperationBase.cs:203)

UnityEngine.ResourceManagement.AsyncOperations.AsyncOperationBase1[TObject].Start (UnityEngine.ResourceManagement.ResourceManager rm, UnityEngine.ResourceManagement.AsyncOperations.AsyncOperationHandle dependency, DelegateList1[T] updateCallbacks) (at Library/PackageCache/com.unity.addressables @1.21.17/Runtime/ResourceManager/AsyncOperations/AsyncOperationBase.cs:528)

UnityEngine.ResourceManagement.ResourceManager.StartOperationTObject (at Library/PackageCache/com.unity.addressables@1.21.17/ Runtime/ResourceManager/ResourceManager.cs:555)

Unityengine.localization.settings.localizedstringdatabase.getLocalizedstringasyncinntternal (unityengine.localization.tables.tablerencencencencencencencers, unityengine.localization.tables.tables.table. ist`1 [t] arguments, unityengine.localization.locale local, unityengine .Localization.Settings.FallbackBehavior fallbackBehavior, UnityEngine.Localization.SmartFormat.PersistentVariables.IVariableGroup localVariables, System.Boolean autoRelease) (at Library/PackageCache/com.unity.localization@1.4.4/Runtime/Settings/Database/LocalizedStringDatabase.cs: 268)

UnityEngine.Localization.Settings.LocalizedStringDatabase.GetLocalizedStringAsync(UnityEngine.Localization.Tables.TableReference tableReference, UnityEngine.Localization.Tables.TableEntryReference tableEntryReference, System.Collections.Generic.IList`1[T] arguments, UnityEngine.Localization.Locale locale, UnityEngine .Localization.Settings.FallbackBehavior fallbackBehavior, UnityEngine.Localization.SmartFormat.PersistentVariables.IVariableGroup localVariables) (at Library/PackageCache/com.unity.localization@1.4.4/Runtime/Settings/Database/LocalizedStringDatabase.cs:258)

UnityEngine.Localization.LocalizedString.GetLocalizedStringAsync (System.Collections.Generic.IList`1[T] arguments) (at Library/PackageCache/com.unity.localization@1.4.4/Runtime/Localized Reference/LocalizedString.cs:311)

UnityEngine.Localization.LocalizedString.GetLocalizedStringAsync() (at Library/PackageCache/com.unity.localization@1.4.4/Runtime/Localized Reference/LocalizedString.cs:263)

UnityEngine.Localization.PropertyVariants.TrackedObjects.JsonSerializerTrackedObject.ApplyLocale (UnityEngine.Localization.Locale variantLocale, UnityEngine.Localization.Locale defaultLocale) (at Library/PackageCache/com.unity.localization@1.4.4/Runtime/Property Variants/Tracked Objects/ JsonSerializerTrackedObject.cs:184)

UnityEngine.Localization.PropertyVariants.GameObjectLocalizer.ApplyLocaleVariant (UnityEngine.Localization.Locale locale, UnityEngine.Localization.Locale fallback) (at Library/PackageCache/com.unity.localization@1.4.4/Runtime/Property Variants/GameObjectLocalizer.cs:191 )

UnityEngine.Localization.PropertyVariants.GameObjectLocalizer.ApplyLocaleVariant (UnityEngine.Localization.Locale locale) (at Library/PackageCache/com.unity.localization@1.4.4/Runtime/Property Variants/GameObjectLocalizer.cs:165)

UnityEngine.Localization.PropertyVariants.GameObjectLocalizer.SelectedLocaleChanged (UnityEngine.Localization.Locale locale) (at Library/PackageCache/com.unity.localization@1.4.4/Runtime/Property Variants/GameObjectLocalizer.cs:101)

UnityEngine.Localization.PropertyVariants.GameObjectLocalizer+d__8.MoveNext() (at Library/PackageCache/com.unity.localization@1.4.4/Runtime/Property Variants/GameObjectLocalizer.cs:90)

UnityEngine.SetupCoroutine.InvokeMoveNext (System.Collections.IEnumerator enumerator, System.IntPtr returnValueAddress) (at :0)
[/quote]

Thanks if you guys answer my questions, any suggestions would be appreciated.

1 Like

Hi,
Could you please file a bug report? https://unity.com/releases/editor/qa/bug-reporting

Same problem, any suggestions to solve?


Hi,
If you are not already using it first try updating to 1.4.5. If its not visible in the package manager you can edit the manifest.json file in the Packages folder to force an update. If that does not fix the issue then please file a bug report.
https://unity.com/releases/editor/qa/bug-reporting


Hi, I sent a bug report. Package version is 1.4.5. It's appearing when I change locale, no matter from editor or via code on play mode.

1 Like

Hi! Was this solved? I'm getting the same issue. Can you send the bug report link? Thanks


Try 1.5.0-pre.7, if it's not in the package manager then you can change the manifest.json file in the package folder to update. If that doesn't fix it then we need a bug report because that has all known bugs fixed in it.

Great!

I was already using 1.5.0-pre7 but must have installed it wrong because after reinstalling (using the .json package file from unity's package manager) the bug went away

Thanks! :)

1 Like