Unity 5.3.2p1 iOS Crash

More
3 years 6 months ago #1230 by MooseMouse
I am using the latest version of I2 localization plugin, 2.6.4 b1

Since upgrading to Unity 5.3.2p1 today, my game is crashing on launch on iOS. Here are the Xcode logs:
Failed to postprocess stacktrace
ArgumentException: Destination array was not long enough. Check destIndex and length, and the array's lower bounds
  at System.Array.Copy (System.Array sourceArray, Int32 sourceIndex, System.Array destinationArray, Int32 destinationIndex, Int32 length) [0x00000] in <filename unknown>:0 
  at System.Collections.ArrayList.ToArray (System.Type type) [0x00000] in <filename unknown>:0 
  at Mono.Globalization.Unicode.MSCompatUnicodeTable.BuildTailoringTables (System.Globalization.CultureInfo culture, Mono.Globalization.Unicode.TailoringInfo t, Mono.Globalization.Unicode.Contraction[]& contractions, Mono.Globalization.Unicode.Level2Map[]& diacriticals) [0x00000] in <filename unknown>:0 
  at Mono.Globalization.Unicode.SimpleCollator..ctor (System.Globalization.CultureInfo culture) [0x00000] in <filename unknown>:0 
  at Mono.Globalization.Unicode.SimpleCollator..cctor () [0x00000] in <filename unknown>:0 
  at System.Globalization.CompareInfo..ctor (System.Globalization.CultureInfo ci) [0x00000] in <filename unknown>:0 
  at System.Globalization.CultureInfo.get_CompareInfo () [0x00000] in <filename unknown>:0 
  at System.String.EndsWith (System.String value) [0x00000] in <filename unknown>:0 
  at I2.Loc.ResourceManager.LoadFromResources[T] (System.String Path) [0x00000] in <filename unknown>:0 
  at I2.Loc.LocalizationManager.RegisterSourceInResources () [0x00000] in <filename unknown>:0 
  at I2.Loc.LocalizationManager.UpdateSources () [0x00000] in <filename unknown>:0 
  at I2.Loc.LocalizationManager.InitializeIfNeeded () [0x00000] in <filename unknown>:0 
  at I2.Loc.LocalizationManager.get_CurrentLanguage () [0x00000] in <filename unknown>:0 
  at I2.Loc.Localize.OnLocalize (Boolean Force) [0x00000] in <filename unknown>:0 
Rethrow as TypeInitializationException: The type initializer for 'Mono.Globalization.Unicode.SimpleCollator' threw an exception.
  at System.Globalization.CompareInfo..ctor (System.Globalization.CultureInfo ci) [0x00000] in <filename unknown>:0 
  at System.Globalization.CultureInfo.get_CompareInfo () [0x00000] in <filename unknown>:0 
  at System.String.EndsWith (System.String value) [0x00000] in <filename unknown>:0 
  at I2.Loc.ResourceManager.LoadFromResources[T] (System.String Path) [0x00000] in <filename unknown>:0 
  at I2.Loc.LocalizationManager.RegisterSourceInResources () [0x00000] in <filename unknown>:0 
  at I2.Loc.LocalizationManager.UpdateSources () [0x00000] in <filename unknown>:0 
  at I2.Loc.LocalizationManager.InitializeIfNeeded () [0x00000] in <filename unknown>:0 
  at I2.Loc.LocalizationManager.get_CurrentLanguage () [0x00000] in <filename unknown>:0 
  at I2.Loc.Localize.OnLocalize (Boolean Force) [0x00000] in <filename unknown>:0 
 
(Filename: currently not available on il2cpp Line: -1)

Failed to extract il2cpp stacktrace from Log message
Unhandled Exception: System.TypeInitializationException: The type initializer for 'Mono.Globalization.Unicode.SimpleCollator' threw an exception. ---> System.ArgumentException: Destination array was not long enough. Check destIndex and length, and the array's lower bounds
  at System.Array.Copy (System.Array sourceArray, Int32 sourceIndex, System.Array destinationArray, Int32 destinationIndex, Int32 length) [0x00000] in <filename unknown>:0 
  at System.Collections.ArrayList.ToArray (System.Type type) [0x00000] in <filename unknown>:0 
  at Mono.Globalization.Unicode.MSCompatUnicodeTable.BuildTailoringTables (System.Globalization.CultureInfo culture, Mono.Globalization.Unicode.TailoringInfo t, Mono.Globalization.Unicode.Contraction[]& contractions, Mono.Globalization.Unicode.Level2Map[]& diacriticals) [0x00000] in <filename unknown>:0 
  at Mono.Globalization.Unicode.SimpleCollator..ctor (System.Globalization.CultureInfo culture) [0x00000] in <filename unknown>:0 
  at Mono.Globalization.Unicode.SimpleCollator..cctor () [0x00000] in <filename unknown>:0 
  at System.Globalization.CompareInfo..ctor (System.Globalization.CultureInfo ci) [0x00000] in <filename unknown>:0 
  at System.Globalization.CultureInfo.get_CompareInfo () [0x00000] in <filename unknown>:0 
  at System.String.EndsWith (System.String value) [0x00000] in <filename unknown>:0 
  at I2.Loc.ResourceManager.LoadFromResources[T] (System.String Path) [0x00000] in <filename unknown>:0 
  at I2.Loc.LocalizationManager.RegisterSourceInResources () [0x00000] in <filename unknown>:0 
  at I2.Loc.LocalizationManager.UpdateSources () [0x00000] in <filename unknown>:0 
  at I2.Loc.LocalizationManager.InitializeIfNeeded () [0x00000] in <filename unknown>:0 
  at I2.Loc.LocalizationManager.get_CurrentLanguage () [0x00000] in <filename unknown>:0 
  at I2.Loc.Localize.OnLocalize (Boolean Force) [0x00000] in <filename unknown>:0 
  --- End of inner exception stack trace ---
  at System.Globalization.CompareInfo..ctor (System.Globalization.CultureInfo ci) [0x00000] in <filename unknown>:0 
  at System.Globalization.CultureInfo.get_CompareInfo () [0x00000] in <filename unknown>:0 
  at System.String.EndsWith (System.String value) [0x00000] in <filename unknown>:0 
  at I2.Loc.ResourceManager.LoadFromResources[T] (System.String Path) [0x00000] in <filename unknown>:0 
  at I2.Loc.LocalizationManager.RegisterSourceInResources () [0x00000] in <filename unknown>:0 
  at I2.Loc.LocalizationManager.UpdateSources () [0x00000] in <filename unknown>:0 
  at I2.Loc.LocalizationManager.InitializeIfNeeded () [0x00000] in <filename unknown>:0 
  at I2.Loc.LocalizationManager.get_CurrentLanguage () [0x00000] in <filename unknown>:0 
  at I2.Loc.Localize.OnLocalize (Boolean Force) [0x00000] in <filename unknown>:0 
 
(Filename: /Users/builduser/buildslave/unity/build/artifacts/generated/common/runtime/UnityEngineDebugBindings.gen.cpp Line: 37)

Failed to extract il2cpp stacktrace from Log message
Inner Exception: System.ArgumentException: Destination array was not long enough. Check destIndex and length, and the array's lower bounds
  at System.Array.Copy (System.Array sourceArray, Int32 sourceIndex, System.Array destinationArray, Int32 destinationIndex, Int32 length) [0x00000] in <filename unknown>:0 
  at System.Collections.ArrayList.ToArray (System.Type type) [0x00000] in <filename unknown>:0 
  at Mono.Globalization.Unicode.MSCompatUnicodeTable.BuildTailoringTables (System.Globalization.CultureInfo culture, Mono.Globalization.Unicode.TailoringInfo t, Mono.Globalization.Unicode.Contraction[]& contractions, Mono.Globalization.Unicode.Level2Map[]& diacriticals) [0x00000] in <filename unknown>:0 
  at Mono.Globalization.Unicode.SimpleCollator..ctor (System.Globalization.CultureInfo culture) [0x00000] in <filename unknown>:0 
  at Mono.Globalization.Unicode.SimpleCollator..cctor () [0x00000] in <filename unknown>:0 
  at System.Globalization.CompareInfo..ctor (System.Globalization.CultureInfo ci) [0x00000] in <filename unknown>:0 
  at System.Globalization.CultureInfo.get_CompareInfo () [0x00000] in <filename unknown>:0 
  at System.String.EndsWith (System.String value) [0x00000] in <filename unknown>:0 
  at I2.Loc.ResourceManager.LoadFromResources[T] (System.String Path) [0x00000] in <filename unknown>:0 
  at I2.Loc.LocalizationManager.RegisterSourceInResources () [0x00000] in <filename unknown>:0 
  at I2.Loc.LocalizationManager.UpdateSources () [0x00000] in <filename unknown>:0 
  at I2.Loc.LocalizationManager.InitializeIfNeeded () [0x00000] in <filename unknown>:0 
  at I2.Loc.LocalizationManager.get_CurrentLanguage () [0x00000] in <filename unknown>:0 
  at I2.Loc.Localize.OnLocalize (Boolean Force) [0x00000] in <filename unknown>:0 
 
(Filename: /Users/builduser/buildslave/unity/build/artifacts/generated/common/runtime/UnityEngineDebugBindings.gen.cpp Line: 37)

crazysk8r was compiled with optimization - stepping may behave oddly; variables may not be available.
(lldb)

It looks like a problem with the I2 localization plugin. The timing with the upgrade to Unity 5.3.2p1 could be coincidence since I haven't made an iOS build in a few weeks. This error was also occurring with the I2 localization plugin just prior to 2.6.4 b1 (I don't remember what number that was).

Does anyone have any idea what could be going wrong? The game plays without error in the Unity Editor.

Thanks in advance!

Please Log in or Create an account to join the conversation.

More
3 years 6 months ago #1231 by Frank
Replied by Frank on topic Unity 5.3.2p1 iOS Crash
Hi,
I'm testing now trying to reproduce the issue, I tested deploying a couple test projects I had but they ran fine, I'm going to try a more complex one now.

Nonetheless, by the look of it, there seems to be an issue in il2cpp and the CultureInfo (as soon as I reproduce the problem will confirm that's right).
Just in case, I also added a couple checks in the ResourceManager and forced the CultureInfo for comparing to be the correct one.

Can you try changing the function LoadFromResources in line 82 (ResourcesManager.cpp) by this one:
		public T LoadFromResources<T>( string Path ) where T : Object
		{
			if (string.IsNullOrEmpty(Path))
				return null;
			
			Object Obj;
			// Doing Resource.Load is very slow so we are catching the recently loaded objects
			if (mResourcesCache.TryGetValue(Path, out Obj) && Obj!=null)
			{
				return Obj as T;
			}

			T obj = null;

			if (Path.EndsWith("]", System.StringComparison.OrdinalIgnoreCase))	// Handle sprites (Multiple) loaded from resources :   "SpritePath[SpriteName]"
			{
				int idx = Path.LastIndexOf("[", System.StringComparison.OrdinalIgnoreCase);
				int len = Path.Length-idx-2;
				string MultiSpriteName = Path.Substring(idx+1, len);
				Path = Path.Substring(0, idx);
				
				T[] objs = Resources.LoadAll<T>(Path);
				for (int j=0, jmax=objs.Length; j<jmax; ++j)
					if (objs[j].name.Equals(MultiSpriteName))
					{
						obj = objs[j];
						break;
					}
			}
			else
				obj = Resources.Load<T>(Path);

			mResourcesCache[Path] = obj;

			if (!mCleaningScheduled)
			{
				Invoke("CleanResourceCache", 0.1f);
				mCleaningScheduled = true;
			}
			return obj;
		}


Also, can you double check that the paths of the referenced objects its not wrong/corrupted.

- If you have a ResourceManager object in the scene, check the list of its references and delete any empty slot.

- Do the same on the I2Languages.prefab and any other LanguageSource (On the last tab ["Assets"] delete anything invalid)





Also, are you using any stripping method when building? If so, can you please test if the problem happens also when not using code stripping?
(This last could solve the issue if il2cpp is dropping those classes)

Hope that helps, nonetheless, I will continue testing to see if I can reproduce that crash.

Thanks,
Frank

Are you :-) Give I2L 5 stars!
Are you :-( Please lets us know how to improve it!
To get the betas as soon as they are ready, check this out
Attachments:

Please Log in or Create an account to join the conversation.

More
3 years 6 months ago - 3 years 6 months ago #1234 by MooseMouse
Replied by MooseMouse on topic Unity 5.3.2p1 iOS Crash
Hi Frank,

Thanks for getting back to me. I've tried all of the suggestions above:
1. Revised LoadFromResources in ResourcesManager.cs as described above. There is no ResourcesManager.cpp.
2. Double checked that the paths of the referenced objects its not wrong/corrupted. They are not wrong or corrupted. There is no ResourceManager object in the scene, but I verified the prefab paths.
3. Stripping is handled automatically with il2ccp.. I have no control over it.
4. I changed "API Compatibility Level" to ".NET 2.0". It was previously ".NET 2.0 Subset".
5. Set "Script Call Optimization" to "Slow and Safe".

but am still getting the crash:

Failed to postprocess stacktrace
ArgumentException: Destination array was not long enough. Check destIndex and length, and the array's lower bounds
at System.Array.Copy (System.Array sourceArray, Int32 sourceIndex, System.Array destinationArray, Int32 destinationIndex, Int32 length) [0x00000] in <filename unknown>:0
at System.Array.Copy (System.Array sourceArray, System.Array destinationArray, Int32 length) [0x00000] in <filename unknown>:0
at System.Collections.ArrayList.CopyTo (System.Array array) [0x00000] in <filename unknown>:0
at System.Collections.ArrayList.ToArray (System.Type type) [0x00000] in <filename unknown>:0
at Mono.Globalization.Unicode.MSCompatUnicodeTable.BuildTailoringTables (System.Globalization.CultureInfo culture, Mono.Globalization.Unicode.TailoringInfo t, Mono.Globalization.Unicode.Contraction[]& contractions, Mono.Globalization.Unicode.Level2Map[]& diacriticals) [0x00000] in <filename unknown>:0
at Mono.Globalization.Unicode.SimpleCollator..ctor (System.Globalization.CultureInfo culture) [0x00000] in <filename unknown>:0
at Mono.Globalization.Unicode.SimpleCollator..cctor () [0x00000] in <filename unknown>:0
at System.Globalization.CompareInfo..ctor (System.Globalization.CultureInfo ci) [0x00000] in <filename unknown>:0
at System.Globalization.CultureInfo.get_CompareInfo () [0x00000] in <filename unknown>:0
at System.String.EndsWith (System.String value, StringComparison comparisonType) [0x00000] in <filename unknown>:0
at I2.Loc.ResourceManager.LoadFromResources[T] (System.String Path) [0x00000] in <filename unknown>:0
at I2.Loc.ResourceManager.GetAsset[T] (System.String Name) [0x00000] in <filename unknown>:0
at I2.Loc.LocalizationManager.RegisterSourceInResources () [0x00000] in <filename unknown>:0
at I2.Loc.LocalizationManager.UpdateSources () [0x00000] in <filename unknown>:0
at I2.Loc.LocalizationManager.InitializeIfNeeded () [0x00000] in <filename unknown>:0
at I2.Loc.LocalizationManager.get_CurrentLanguage () [0x00000] in <filename unknown>:0
at I2.Loc.Localize.OnLocalize (Boolean Force) [0x00000] in <filename unknown>:0
at I2.Loc.Localize.Awake () [0x00000] in <filename unknown>:0
Rethrow as TypeInitializationException: The type initializer for 'Mono.Globalization.Unicode.SimpleCollator' threw an exception.
at System.Globalization.CompareInfo..ctor (System.Globalization.CultureInfo ci) [0x00000] in <filename unknown>:0
at System.Globalization.CultureInfo.get_CompareInfo () [0x00000] in <filename unknown>:0
at System.String.EndsWith (System.String value, StringComparison comparisonType) [0x00000] in <filename unknown>:0
at I2.Loc.ResourceManager.LoadFromResources[T] (System.String Path) [0x00000] in <filename unknown>:0
at I2.Loc.ResourceManager.GetAsset[T] (System.String Name) [0x00000] in <filename unknown>:0
at I2.Loc.LocalizationManager.RegisterSourceInResources () [0x00000] in <filename unknown>:0
at I2.Loc.LocalizationManager.UpdateSources () [0x00000] in <filename unknown>:0
at I2.Loc.LocalizationManager.InitializeIfNeeded () [0x00000] in <filename unknown>:0
at I2.Loc.LocalizationManager.get_CurrentLanguage () [0x00000] in <filename unknown>:0
at I2.Loc.Localize.OnLocalize (Boolean Force) [0x00000] in <filename unknown>:0
at I2.Loc.Localize.Awake () [0x00000] in <filename unknown>:0

(Filename: currently not available on il2cpp Line: -1)


Any further thoughts?


EDIT: This may be related to a problem described in this post on the Unity forums:
http://forum.unity3d.com/threads/ios-player-5-3-2p1-throw-exception-on-system-enum-tostring.382765/

EDIT 2: This problem does *NOT* occur when building with Unity 5.3.1p4, so I believe it is a Unity bug.
Last edit: 3 years 6 months ago by MooseMouse.

Please Log in or Create an account to join the conversation.

Time to create page: 0.148 seconds
Template by JoomlaShine