Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Crash when run on IOS device
#1
Hi

I'm getting an exception when the scene start in Xcode. The scene runs fine in the editor and the 2 objects following a spline all
work fine. but as soon as I try and run on IOS device it crashes with this error:

NullReferenceException: A null value was found where an object instance was required.
  at FluffyUnderware.DevTools.UnityEventEx`1[T0].HasListeners () [0x00000] in <filename unknown>:0 
  at FluffyUnderware.Curvy.Controllers.SplineController.BindEvents () [0x00000] in <filename unknown>:0 
 
(Filename: currently not available on il2cpp Line: -1)

NullReferenceException: A null value was found where an object instance was required.
  at FluffyUnderware.DevTools.UnityEventEx`1[T0].HasListeners () [0x00000] in <filename unknown>:0 
  at FluffyUnderware.Curvy.Controllers.SplineController.BindEvents () [0x00000] in <filename unknown>:0 
UnityEngine.UnhandledExceptionHandlerTonguerintException(String, Exception)
UnityEngine.UnhandledExceptionHandler:HandleUnhandledException(Object, UnhandledExceptionEventArgs)
 
(Filename: currently not available on il2cpp Line: -1)

The crash is in your HasListeners function, when I comment it out the spline follower it all works fine.

    public bool HasListeners()
       {
#if false
           if (mCallsCount == null)
           {
               var fi = typeof(UnityEventBase).FieldByName("m_Calls", false, true);
               if (fi != null)
               {
                   mCallerList = fi.GetValue(this);
                   if (mCallerList != null)
                       mCallsCount = mCallerList.GetType().PropertyByName("Count").GetGetMethod();
               }
           }
           if (mCount == -1)
           {
               if (mCallerList != null && mCallsCount != null)
                   mCount = (int)mCallsCount.Invoke(mCallerList, null); //.GetValue(mCallerList, null);
               mCount += GetPersistentEventCount();
           }
           return (mCount > 0);
#endif
           return (mCount > 0);
       }






Any ideas?
Reply
#2
(12-02-2017, 05:53 AM)arkon3 Wrote: Hi

I'm getting an exception when the scene start in Xcode. The scene runs fine in the editor and the 2 objects following a spline all
work fine. but as soon as I try and run on IOS device it crashes with this error:

NullReferenceException: A null value was found where an object instance was required.
  at FluffyUnderware.DevTools.UnityEventEx`1[T0].HasListeners () [0x00000] in <filename unknown>:0 
  at FluffyUnderware.Curvy.Controllers.SplineController.BindEvents () [0x00000] in <filename unknown>:0 
 
(Filename: currently not available on il2cpp Line: -1)

NullReferenceException: A null value was found where an object instance was required.
  at FluffyUnderware.DevTools.UnityEventEx`1[T0].HasListeners () [0x00000] in <filename unknown>:0 
  at FluffyUnderware.Curvy.Controllers.SplineController.BindEvents () [0x00000] in <filename unknown>:0 
UnityEngine.UnhandledExceptionHandlerTonguerintException(String, Exception)
UnityEngine.UnhandledExceptionHandler:HandleUnhandledException(Object, UnhandledExceptionEventArgs)
 
(Filename: currently not available on il2cpp Line: -1)

The crash is in your HasListeners function, when I comment it out the spline follower it all works fine.

    public bool HasListeners()
       {
#if false
           if (mCallsCount == null)
           {
               var fi = typeof(UnityEventBase).FieldByName("m_Calls", false, true);
               if (fi != null)
               {
                   mCallerList = fi.GetValue(this);
                   if (mCallerList != null)
                       mCallsCount = mCallerList.GetType().PropertyByName("Count").GetGetMethod();
               }
           }
           if (mCount == -1)
           {
               if (mCallerList != null && mCallsCount != null)
                   mCount = (int)mCallsCount.Invoke(mCallerList, null); //.GetValue(mCallerList, null);
               mCount += GetPersistentEventCount();
           }
           return (mCount > 0);
#endif
           return (mCount > 0);
       }






Any ideas?

We ran into this issue as well. We upgraded to 2017.2 and this started to happen exclusively on iOS.

Having investigated the problem, we realized that Unity 2017.2 introduced a couple of breaking changes: namely, that the Unity DLLs are no longer packaged in the same assembly. Curvy ships with a link.xml to prevent iOS from stripping certain assemblies it's only using for Reflection - including

Code:
<linker>
 <assembly fullname="UnityEngine">
  <type fullname="UnityEngine.Events.*" preserve="all" />
 </assembly>
 <assembly fullname="Assembly-CSharp">
  <type fullname="FluffyUnderware.*" preserve="all" />
 </assembly>
</linker>

However, in 2017.2 Events is now under UnityEngine.CoreModule, so we updated the link.xml to be:

<linker>
  <assembly fullname="UnityEngine">
   <type fullname="UnityEngine.Events.*" preserve="all" />
  </assembly>
<assembly fullname="UnityEngine.CoreModule">
   <type fullname="UnityEngine.Events.*" preserve="all" />
  </assembly>
  <assembly fullname="Assembly-CSharp">
   <type fullname="FluffyUnderware.*" preserve="all" />
  </assembly>
 </linker> 
 

And it seemed to work. Hope that helps!
Reply
#3
Thanks a lot for this
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
Bug Unity Play Mode Crash In Example 4 etoreo 2 4 01-05-2023, 10:46 PM
Last Post: etoreo
  Unity Crash on Curvy Default Event Handler Trainzland 6 10,622 01-21-2016, 12:25 AM
Last Post: Trainzland
  Unity Freeze (Crash) rangerori 1 4,580 02-03-2014, 03:54 PM
Last Post: slester

Forum Jump: