I'll save the crash dump for last to spare everyone the agony. Usually when you see an error for "System.MissingMethodException: No constructor found for ViewController::.ctor(System.IntPtr)" its because you didn't keep a hard reference for your object around. I assure you that I'm keeping a ref to this ViewController via a private class member.
In low memory situations, when the phone has lots of background apps open, my app gets a memory warning and this is usually when the crash occurs. I think what is happening is that GC collects the ViewController before native code calls ViewDidUnload(). GC collecting the object is the right thing at that point because I am finished with the ViewController; I don't need it anymore. Should I just go ahead and implement the ctor(IntPtr handle) to satiate MonoTouch? Implementing the ctor definitely gets rid of the crash. Or is there something else I can do? [ERROR] FATAL UNHANDLED EXCEPTION: System.Exception: Selector invoked from objective-c on a managed object that has been GC'ed ---> System.MissingMethodException: No constructor found for SomeApp.iPhone.Controllers.Plans.Details.DetailsViewController::.ctor(System.IntPtr) at System.Activator.CreateInstance (System.Type type, BindingFlags bindingAttr, System.Reflection.Binder binder, System.Object[] args, System.Globalization.CultureInfo culture, System.Object[] activationAttributes) [0x00000] in <filename unknown>:0 at System.Activator.CreateInstance (System.Type type, System.Object[] args, System.Object[] activationAttributes) [0x00000] in <filename unknown>:0 at System.Activator.CreateInstance (System.Type type, System.Object[] args) [0x00000] in <filename unknown>:0 at MonoTouch.ObjCRuntime.Runtime.ConstructNSObject (IntPtr ptr, IntPtr klass) [0x00000] in <filename unknown>:0 --- End of inner exception stack trace --- at MonoTouch.ObjCRuntime.Runtime.ConstructNSObject (IntPtr ptr, IntPtr klass) [0x00000] in <filename unknown>:0 at MonoTouch.ObjCRuntime.Runtime.GetNSObject (IntPtr ptr) [0x00000] in <filename unknown>:0 at MonoTouch.ObjCRuntime.Runtime.GetNSObjectWrapped (IntPtr ptr) [0x00000] in <filename unknown>:0 at (wrapper native-to-managed) MonoTouch.ObjCRuntime.Runtime:GetNSObjectWrapped (intptr) 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 SomeApp.iPhone.Application.Main (System.String[] args) [0x00000] in /Users/Andrew/Projects/saambaa-iphone/SomeApp.iPhone/Main.cs:23 Terminating runtime due to unhandled exception Stacktrace: Native stacktrace: 0 SomeAppiPhone 0x00b597cc mono_handle_native_sigsegv + 412 1 SomeAppiPhone 0x00b85000 sigabrt_signal_handler + 148 2 libsystem_c.dylib 0x34bd272f _sigtramp + 42 3 libsystem_c.dylib 0x34bc73bb pthread_kill + 58 4 libsystem_c.dylib 0x34bbfbff abort + 78 5 SomeAppiPhone 0x00cc3874 monoeg_g_logv + 248 6 SomeAppiPhone 0x00cc3908 monoeg_assertion_message + 44 7 SomeAppiPhone 0x00b2dca0 mono_thread_abort + 224 8 SomeAppiPhone 0x00b581f0 mono_handle_exception_internal + 2436 9 SomeAppiPhone 0x00b58e68 mono_handle_exception + 108 10 SomeAppiPhone 0x00b82e64 mono_arm_throw_exception + 324 11 SomeAppiPhone 0x00833b14 throw_exception + 48 12 SomeAppiPhone 0x00491330 MonoTouch_ObjCRuntime_Runtime_GetNSObject_intptr + 144 13 SomeAppiPhone 0x004913b0 MonoTouch_ObjCRuntime_Runtime_GetNSObjectWrapped_intptr + 28 14 SomeAppiPhone 0x004cf1f8 wrapper_native_to_managed_MonoTouch_ObjCRuntime_Runtime_GetNSObjectWrapped_intptr + 64 15 SomeAppiPhone 0x00ce7744 get_managed_object_for_ptr + 136 16 SomeAppiPhone 0x00cea8e0 monotouch_trampoline + 76 17 UIKit 0x35df7a29 -[UIViewController unloadViewForced:] + 172 18 UIKit 0x35e076b9 -[UIViewController unloadViewIfReloadable] + 16 19 UIKit 0x35e4e12d -[UIViewController purgeMemoryForReason:] + 40 20 UIKit 0x35e4e14d -[UIViewController didReceiveMemoryWarning] + 16 21 UIKit 0x35e4e163 -[UIViewController _didReceiveMemoryWarning:] + 14 22 Foundation 0x3529d183 _nsnote_callback + 142 23 CoreFoundation 0x36eb420f __CFXNotificationPost_old + 402 24 CoreFoundation 0x36e4eeeb _CFXNotificationPostNotification + 118 25 Foundation 0x3529a5d3 -[NSNotificationCenter postNotificationName:object:userInfo:] + 70 26 Foundation 0x3529c1c1 -[NSNotificationCenter postNotificationName:object:] + 24 27 UIKit 0x35e24361 -[UIApplication _performMemoryWarning] + 48 28 UIKit 0x35e24d83 -[UIApplication _receivedMemoryNotification] + 126 29 UIKit 0x35e22507 _memoryStatusChanged + 42 30 CoreFoundation 0x36eb4d69 __CFNotificationCenterDarwinCallBack + 24 31 CoreFoundation 0x36eb1bdf __CFMachPortPerform + 210 32 CoreFoundation 0x36ebca97 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE1_PERFORM_FUNCTION__ + 26 33 CoreFoundation 0x36ebe83f __CFRunLoopDoSource1 + 166 34 CoreFoundation 0x36ebf60d __CFRunLoopRun + 520 35 CoreFoundation 0x36e4fec3 CFRunLoopRunSpecific + 230 36 CoreFoundation 0x36e4fdcb CFRunLoopRunInMode + 58 37 GraphicsServices 0x3660941f GSEventRunModal + 114 38 GraphicsServices 0x366094cb GSEventRun + 62 39 UIKit 0x35cf9d69 -[UIApplication _run] + 404 40 UIKit 0x35cf7807 UIApplicationMain + 670 41 SomeAppiPhone 0x004ce9f4 wrapper_managed_to_native_MonoTouch_UIKit_UIApplication_UIApplicationMain_int_string___intptr_intptr + 240 42 SomeAppiPhone 0x0049498c MonoTouch_UIKit_UIApplication_Main_string__ + 36 43 SomeAppiPhone 0x00328738 SomeApp_iPhone_Application_Main_string__ + 128 44 SomeAppiPhone 0x007e2d00 wrapper_runtime_invoke_object_runtime_invoke_dynamic_intptr_intptr_intptr_intptr + 200 45 SomeAppiPhone 0x00b32760 mono_jit_runtime_invoke + 2800 46 SomeAppiPhone 0x00c3c89c mono_runtime_invoke + 140 47 SomeAppiPhone 0x00c3f934 mono_runtime_exec_main + 784 48 SomeAppiPhone 0x00c3e964 mono_runtime_run_main + 1048 49 SomeAppiPhone 0x00b3ddf8 mono_jit_exec + 216 50 SomeAppiPhone 0x00b28d20 main + 5300 51 SomeAppiPhone 0x00002c08 start + 40 Debug info from gdb: ================================================================= Got a SIGABRT while executing native code. This usually indicates a fatal error in the mono runtime or one of the native libraries used by your application. =================================================================
_______________________________________________ MonoTouch mailing list [email protected] http://lists.ximian.com/mailman/listinfo/monotouch
