- Home /
Infinite loop crash System.Enum.ToString()
Occasionally my game will freeze, and finally I got it to occur on the desktop where I had the debugger instead of out in the wild on the iPad. When I attached the MonoDevelop debugger I was shocked to see the following callstack.
 System.Array.DoBinarySearch (array={Locomotor.AnimType[2]}, index=0, length=2, value=0, comparer={System.MonoEnumInfo.IntComparer}) in /Applications/buildAgent/work/3df08680c6f85295/mcs/class/corlib/System/Array.cs:872
 System.Array.BinarySearch (array={Locomotor.AnimType[2]}, value=0, comparer={System.MonoEnumInfo.IntComparer}) in /Applications/buildAgent/work/3df08680c6f85295/mcs/class/corlib/System/Array.cs:789
 System.Enum.FindPosition (value=Locomotor+AnimType.Idle, values={Locomotor.AnimType[2]}) in /Applications/buildAgent/work/3df08680c6f85295/mcs/class/corlib/System/Enum.cs:401
 System.Enum.GetName (enumType={Locomotor+AnimType}, value=Locomotor+AnimType.Idle) in /Applications/buildAgent/work/3df08680c6f85295/mcs/class/corlib/System/Enum.cs:470
 System.Enum.Format (enumType={Locomotor+AnimType}, value=0, format="G") in /Applications/buildAgent/work/3df08680c6f85295/mcs/class/corlib/System/Enum.cs:1036
 System.Enum.ToString (format="G") in /Applications/buildAgent/work/3df08680c6f85295/mcs/class/corlib/System/Enum.cs:720
 System.Enum.ToString () in /Applications/buildAgent/work/3df08680c6f85295/mcs/class/corlib/System/Enum.cs:704
 Locomotor.playAnimation (animType=Locomotor+AnimType.Idle, direction=Map+Direction.North) in /Users/colinday/Documents/Development/Wizard/Dev/Unity/Assets/Scripts/Actor/Locomotor.cs:433
 Locomotor.Orient (direction=Map+Direction.North) in /Users/colinday/Documents/Development/Wizard/Dev/Unity/Assets/Scripts/Actor/Locomotor.cs:85
 Actor.ChangeOrientation (direction=Map+Direction.North) in /Users/colinday/Documents/Development/Wizard/Dev/Unity/Assets/Scripts/Actor/Actor.cs:572
 Actor.OrientTo (coord={(6, 8)}) in /Users/colinday/Documents/Development/Wizard/Dev/Unity/Assets/Scripts/Actor/Actor.cs:591
 AssemblyCSharp.ActionUse.Start (actionManager={AssemblyCSharp.ActionManager}) in /Users/colinday/Documents/Development/Wizard/Dev/Unity/Assets/Scripts/Actor/Action/ActionUse.cs:45
 AssemblyCSharp.ActionManager.updateTurn () in /Users/colinday/Documents/Development/Wizard/Dev/Unity/Assets/Scripts/Actor/Action/ActionManager.cs:222
 AssemblyCSharp.ActionManager.Update () in /Users/colinday/Documents/Development/Wizard/Dev/Unity/Assets/Scripts/Actor/Action/ActionManager.cs:171
 Map.Update () in /Users/colinday/Documents/Development/Wizard/Dev/Unity/Assets/Scripts/Map/Map.cs:606
 MapManager.Update () in /Users/colinday/Documents/Development/Wizard/Dev/Unity/Assets/Scripts/Map/MapManager.cs:386
It appears that the following line of code is causing an infinite loop inside the system conversion of an enum to a string.
 m_actor.PlayDirectionalAnimation( animType.ToString(), side, facing );
In the above code, animType is an enum that is defined as follows:
     public enum AnimType
     {
         Idle,
         Walk
     }
When I put breakpoints it never comes out of that line of code that is converting animType to a string. It's difficult to believe that there is really an issue with the Enum.ToString(), likely there is something else in my application that is bad which is causing this to fail, but for the life of me I have no idea what. Any ideas?
Your answer
 
 
             Follow this Question
Related Questions
Unity crashes when doing A* pathfinding loop 1 Answer
Infinite Looping Crash 2 Answers
Unity not picking up errors until after reopening 0 Answers
Unity crashes when using while 2 Answers
Unity freezes when OnTriggerEnter occurs 3 Answers
 koobas.hobune.stream
koobas.hobune.stream 
                       
                
                       
			     
			 
                