4.2 iOS Exceptions Not Printed

Prior to Unity 4.2, when a game was run on device exceptions were printed to the device console. When the game crashed due to an error in your code, the exception would be printed along with the class and method name. In debug mode it would also give you a Mono stacktrack and line numbers. This was incredibly useful at debugging issues on device, but seems to have vanished since upgrading to Unity 4.2. I’ve tested the same application on 4.1 and 4.2 side by side, the 4.1 application prints the exception as expected but 4.2 doesn’t. Is there a resolution to this?

If exception was caught by a new crash handler, then there should be a standard iOS crash report generated. If compiled with dSYM symbols, then you should be able to see stack trace. Check in Device Logs in Xcode’s Organizer.

What you can also do for unhandled managed exceptions is to disable iOS crash report generation by setting ENABLE_IOS_CRASH_REPORTING to 0 in CrashReporter.mm in trampoline code, and add this in scripting:

	void Start() {
		AppDomain.CurrentDomain.UnhandledException += new UnhandledExceptionEventHandler(MyHandler);
	}

	static void MyHandler(object sender, UnhandledExceptionEventArgs args) 
	{
		Exception e = (Exception) args.ExceptionObject;
		Console.WriteLine("Exception: " + e.Message);
		Console.WriteLine(e.StackTrace);
	}

IIRC there was something in the 4.2 release notes about new crash reporting stuff on iOS. Maybe the device console is the wrong place to look now?