Search Issue Tracker

By Design

Votes

0

Found in

5.3.3p1

Issue ID

776577

Regression

No

[iOS] Application crashes when throwing an exception from OnGUI click function

iOS

-

Steps to reproduce:

1. Open attached project (CrashLogTest_Stripped.zip)
2. Build the project for iOS
3. Build generated Xcode project to a device
4. Click Unity UI button (white one in the middle)
5. Notice an exception is logged
6. Click the legacy GUI button (top left corner of the screen)
7. Notice the application crashes and exception is not logged

Note: Also tried throwing other exceptions (besides System.Exception) - application still crashes.

RESOLUTION:

The behavior you are seeing is expected. The reasoning is that a lot of the time, uncaught exceptions indicate significant error in app logic and that the internal data is no longer consistent. Thus by default we induce a artificial crash to force Apple crash reporter to create a crash report. The UI code has an explicit try..catch block deep inside on the managed side, thus this does not happen there.

It is possible to change the behavior to what you want. Setting "Script call optimization" to "Slow and safe" will disable crashing on exceptions. This is the only thing the setting changes on IL2CPP; the calls aren't actually slower. We will introduce a separate setting that controls this behavior.

This way, the exception is propagated down into Unity and then logged, as expected.

Add comment

Log in to post comment

All about bugs

View bugs we have successfully reproduced, and vote for the bugs you want to see fixed most urgently.