Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
1 capture
13 Jun 22 - 13 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
This post has been wikified, any user with enough reputation can edit it.
avatar image
2
Question by mviuk · Aug 03, 2013 at 09:27 AM · iosexceptionunity 4.2logging

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?

Comment
Add comment
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

2 Replies

· Add your reply
  • Sort: 
avatar image
1
Best Answer

Answer by Smilediver · Sep 03, 2013 at 09:54 AM

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);
     }
Comment
Add comment · Show 12 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image mviuk · Sep 03, 2013 at 10:06 AM 0
Share

Yep it generates an iOS crash report, but that's next to useless compared to the information we used to get in 4.1.

With ENABLE_IOS_CRASH_REPORTING set, I get a standard error report, but that contains no exception information, with ENABLE_IOS_CRASH_REPORTING unset all I see is:

Sep 3 11:03:51 Barnaby-Smiths-iPad com.apple.launchd[1] (UI$$anonymous$$itApplication:com.kwalee.crashlogtestnew[0x4a99][3152]) : (UI$$anonymous$$itApplication:com.kwalee.crashlogtestnew[0x4a99]) Exited with code: 1

Sep 3 11:03:51 Barnaby-Smiths-iPad backboardd[51] : Application 'UI$$anonymous$$itApplication:com.kwalee.crashlogtestnew[0x4a99]' exited abnormally with exit status 1 I can't work out how to get the information we used to get in 4.1 about what and where the exception was thrown, on 4.1 I would have been told the exception type, class name, method name and if it was a development build line numbers and a stack trace.
avatar image Smilediver ♦♦ · Sep 03, 2013 at 11:36 AM 0
Share

I've updated the answer and added a workaround to get more info for unhandled managed exceptions.

avatar image mviuk · Sep 03, 2013 at 02:24 PM 0
Share

Thanks for your response, unfortunately that hasn't seemed to help. The Debug Information Format is set to DWARF with dSY$$anonymous$$ file by default, there are stack traces in the standard iOS crash report, but there isn't any $$anonymous$$ono information.

I've tried your code for handling the unhandled exception event, unfortunately that doesn't seem to write anything to the console. I'm not too sure on how to proceed, I presume I should be able to access the $$anonymous$$ono exception which crashed the game?

avatar image Smilediver ♦♦ · Sep 03, 2013 at 03:04 PM 0
Share

If $$anonymous$$ono has caught an error (accessing null pointer, or whatever) it will throw an exception in managed side. If it's not caught by any try clauses, then above AppDomain.UnhandledException event will be triggered. If ENABLE_IOS_CRASH_REPORTING is enabled, then Unity will simulate a crash at this point. Basically it just calls CrashedCheckBellowForHintsWhy() function in trampoline code. Generated iOS crash report will lack exception information, but it should include managed calls in the callstack. Though, the names will be mangled to AOT names. For example you should see something like:

 12  libsystem_c.dylib 0x37a9d7e6 _sigtramp + 42 <-- Null access caught
 13  CrashReport 0x00003c98 m_Crash_DoCrash + 36 <-- Real crash here
 14  CrashReport 0x00003960 m_Crash_OnGUI + 60

Here Crash is C# class, and OnGUI and DoCrash are its methods. $$anonymous$$anaged method names generally follow this pattern:

 m_<Class>_<$$anonymous$$ethod>[_<Arg type>]

So if you disable ENABLE_IOS_CRASH_REPORTING and install your own handler like inthe answer, you should be able to inspect the exception. But it could be that in your case exception isn't thrown.

P.S. It's obvious, but... make sure that Start() is called before crash happens. P.S.2. It would be awesome if you could actually make a repro case and submit a bug report with it, so we can improve debugging in this type of situations.

avatar image mviuk · Sep 03, 2013 at 04:02 PM 0
Share

So it turned out I hadn't got Symlink Unity Libraries checked when I built the project from Unity, checking this means I now see $$anonymous$$yHandler get fired which is great :-) Sorry, I shouldn't have missed that.

If I re-enable ENABLE_IOS_CRASH_REPORTING, I don't see the managed call stack like you posted, should I still open a bug report and upload a repro case?

Show more comments
avatar image
0

Answer by superpig · Sep 02, 2013 at 08:29 PM

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?

Comment
Add comment · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this Question

Answers Answers and Comments

17 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

Unity 4.2 IOS Exception Handling 0 Answers

How to log uncaught exceptions on iOS? 1 Answer

Unity 2018.1.9f1 crash when open Photo Album on iOS 10.x 0 Answers

iOS: anti-aliasing causes exc_bad_access exception. 1 Answer

"Assertion failed: Invalid worldAABB. Object is too large or too far away from the origin" not logged 0 Answers


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges