Search Unity

  1. Looking for a job or to hire someone for a project? Check out the re-opened job forums.
    Dismiss Notice
  2. Unity 2020 LTS & Unity 2021.1 have been released.
    Dismiss Notice
  3. Good news ✨ We have more Unite Now videos available for you to watch on-demand! Come check them out and ask our experts any questions!
    Dismiss Notice

Crash on Unity 5.2.3 project

Discussion in 'iOS and tvOS' started by GRSimbite, Dec 9, 2015.

  1. GRSimbite

    GRSimbite

    Joined:
    Sep 8, 2015
    Posts:
    26
    Hi I received a lot of crashes from my users when upgraded project to 5.2.3

    The crash is caused by gameObject.SendMessage() what was ok before the update to Unity 5.2.3.

    crash log:
    1.1crash log.png
    As you can see the crash is just after the ScriptingInvocation::Invoke(
    So from what I understand the code that was throwing the exception is not mine right? Is it Unity ?

    I was lucky to face the issue myself on my device, it was constant on every app run but after reinstalation crash wasn't showing at all :( !?

    Can't get what it exaclty mean. Do I try to invoke method that doesn't exists or on null object ?
     
    Last edited: Dec 9, 2015
  2. JoshPeterson

    JoshPeterson

    Unity Technologies

    Joined:
    Jul 21, 2014
    Posts:
    5,118
    @GRSimbite

    This stack trace is a bit misleading, as it is not where the crash is happening.

    In the Player Settings for iOS you must have the "Script call optimization" setting at a value of "Fast but no exceptions". This means that any managed exceptions which escape out of your managed script code (like a call to an Update method) will cause the AppDomain.UnhandledException event to occur. On iOS Unity adds a handler for this event which records the managed exception for use with the Unity CrashReport API. This handler eventually calls CrashedBelowCheckForHintsWhy (which is an Objective-C method), which in turn terminates the process.

    So you have a few options:
    • Use the Unity CrashReport API to find the cause.
    • Add your own event handler for the AppDomain.UnhandledException event.
    • Debug the C++ code generated by IL2CPP using an exception breakpoint in Xcode.
    Since you can reproduce this locally, I think the third option is best. Is should allow you to quickly see the managed method causing the exception, even if the generated C++ code is a bit difficult to follow.
     
  3. GRSimbite

    GRSimbite

    Joined:
    Sep 8, 2015
    Posts:
    26
    Thanks @JoshPeterson

    Why do you say so ? Could you clear out that for me?

    This option was already set to "Fast but no exceptions" value.

    Like I said I was able to reproduce it but after reinstall of the app (from store) I am no longer able to reproduce it. Why the hell reinstall of the same ipa could fix the issue ? Don't have any idea.
     
    Last edited: Dec 10, 2015
  4. JoshPeterson

    JoshPeterson

    Unity Technologies

    Joined:
    Jul 21, 2014
    Posts:
    5,118
    @GRSimbite

    > Why do you say so ? Could you clear out that for me?

    As I mentioned, this call is not where the managed exception occurred. Instead it is the processing of the unhandled exception that you see on the call stack.

    > This option was already set to "Fast but no exceptions" value.

    Yes, because this option is set, you get the processing of the unhandled exception mentioned above. If this is not set, then you would see the exception managed logged to the Xcode console and execution would continue.

    > Like I said I was able to reproduce it but after reinstall of the app (from store) I am no longer able to reproduce it. Why the hell reinstall of the same ipa could fix the issue ? Don't have any idea.

    Ahh, I missed this as well. I can't say why it doesn't happen after a reinstall. Maybe the exception is intermittent.
     
  5. GRSimbite

    GRSimbite

    Joined:
    Sep 8, 2015
    Posts:
    26
    @JoshPeterson

    Sorry but I am bit confused so write like to noobie person please :)

    Ok : exception was not thrown in the very top method which is CrashedBelowCheckForHintsWhy
    So can I suspect that exception was thrown in the way between
    GameObject_CUSTOM_SendMessage() and ScriptingInvocation::Invoke() ?

    if yes than:
    can I assume that exception was thrown in the method which was passed as SendMessage() argument ?

    I am asking because I am pretty sure I know which method was passed to SendMessage but according to call stack I want to reduce possibilities to minimum.
     
  6. JoshPeterson

    JoshPeterson

    Unity Technologies

    Joined:
    Jul 21, 2014
    Posts:
    5,118
    @GRSimbite

    You're close yes. But really the managed exception could occur in any code called by ScriptingInvocation::Invoke(). So it is likely that the method passed to SendMessage is the culprit (or something it calls).
     
  7. GRSimbite

    GRSimbite

    Joined:
    Sep 8, 2015
    Posts:
    26
    That is enough for me thanks!.

    But can I be 100% sure that the code that thrown the exception was mine? I mean not by Unity SDK ?
     
  8. JoshPeterson

    JoshPeterson

    Unity Technologies

    Joined:
    Jul 21, 2014
    Posts:
    5,118
    @GRSimbite

    No, we cannot be certain of that, as the exception could occur in any code called by your code, which might include something in Unity.
     
  9. GRSimbite

    GRSimbite

    Joined:
    Sep 8, 2015
    Posts:
    26
    Found solution ! Unity SDK is safe :)

    While using soomla for iap I didn't know I have to add new version of the asset store while adding new iap definition to it :( !

    Thanks for helping !
     
  10. JoshPeterson

    JoshPeterson

    Unity Technologies

    Joined:
    Jul 21, 2014
    Posts:
    5,118
    I'm glad to hear that you solved the problem.
     
unityunity