Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

MonoTouch stack traces not detailed

I am trying to implement a useful general exception handler for my MonoTouch code.

If I attach a handler to AppDomain.CurrentDomain.UnhandledException, there is no stack trace present at all, i.e. the .StackTrace property is null or empty.

If I wrap my UIApplication.Main(args) call in try {} catch {}, the stack trace doesn't contain any useful information:

at MonoTouch.UIKit.UIApplication.Main (System.String[] args, System.String principalClassName, System.String delegateClassName) [0x00000] in <filename unknown>:0 
at MonoTouch.UIKit.UIApplication.Main (System.String[] args) [0x00000] in <filename unknown>:0 
at MyNamespace.MyProduct.MyProject.Application.Main (System.String[] args) [0x00000] in <filename unknown>:0 

i.e. it doesn't go any deeper than the Main() method where I caught the exception.

Any ideas how I can get some more useful information in the stack trace at all, or is it all optimised away completely by the AOT compilation? (The stack trace is as expected in debug mode.)

like image 535
tomfanning Avatar asked Oct 11 '22 23:10

tomfanning


1 Answers

Use the --debug command line option or select configuration "Debug|iPhone" in MonoDevelop.

Remember that this option will result in slower execution, but you will get line numbers in exceptions etc.

like image 115
Stanislav Basovník Avatar answered Oct 14 '22 21:10

Stanislav Basovník