Hi Nic!

Thank you for the reply. The button is mapped from a xib file, so it is in
a class scope. I even changed the lambda, I'm currently using an action
instead, but no way. The app is still crashing... :(

Best

Juan M Gómez
*Contractor Software Engineer*
[email protected]

   [image: twitter] <http://twitter.com/_jmgomez_> [image:
linkedIn]<http://es.linkedin.com/in/juamangomalv>



2013/4/3 Nic Wise <[email protected]>

> Hi Juan
>
> here's the key (I think!):
>
> "Unhandled managed exception: Selector invoked from objective-c on a
> managed object of type MonoTouch.UIKit.UIControlEventProxy (0x1432A3B0)
> that has been GC'ed (System.Exception)"
>
> You have something - the UIButton I suspect - which exists in ObjC land,
> which is trying to call the delegate, but the button has been GC'ed in C#
> land, and it has nowhere to call into.
>
> Where is ButtonX declared? Does it only happen when you tap the button?
> Can you move the declaration of ButtonX to somewhere where it will always
> remain in scope? eg, in the class, not in your method?
>
> Cheers
>
> Nic
>
>
>
> On 3 April 2013 17:37, Juan M Gómez <[email protected]> wrote:
>
>> Hi guys,
>>
>> I have a weird issue in my app. I made a custom control with some
>> ViewControllers inside it. The custom control derivates from  UIScrollView,
>> but I think that the issue is not about this, just to clarify.
>>
>> When one, and only one, of thoses uiviewcontroller has a TouchuUpInside
>> via UIButton, the app just crashes although I don't do nothing inside it.
>>
>> ButtonX.TouchUpInside += (sender, e) =>{
>>  //This crashes
>> //If I dont declare this lambda, the app doesnt crash
>> };
>>
>> cheers
>>
>>
>> Unhandled Exception:
>> 0   GolfTouch                           0x000f2fde
>> mono_handle_exception_internal_first_pass + 2190
>> 1   GolfTouch                           0x000f4a22
>> mono_handle_exception_internal + 1602
>> 2   GolfTouch                           0x000f556f mono_handle_exception
>> + 47
>> 3   GolfTouch                           0x001386a2
>> mono_x86_throw_exception + 306
>> 4   ???                                 0x0b5d5f8f 0x0 + 190668687
>> at MonoTouch.ObjCRuntime.Runtime.GetNSObject (intptr) [0x0001f] in
>> /Developer/MonoTouch/Source/monotouch/src/ObjCRuntime/Runtime.cs:328
>> at MonoTouch.ObjCRuntime.Runtime.GetNSObjectWrapped (intptr) [0x00000] in
>> /Developer/MonoTouch/Source/monotouch/src/ObjCRuntime/Runtime.cs:345
>> at (wrapper native-to-managed)
>> MonoTouch.ObjCRuntime.Runtime.GetNSObjectWrapped (intptr) <IL 0x00017,
>> 0x00094>
>> 8   GolfTouch                           0x0026dbd3
>> get_managed_object_for_ptr + 115
>> 9   GolfTouch                           0x00272ac0 monotouch_trampoline +
>> 448
>> 10  libobjc.A.dylib                     0x041f8705 -[NSObject
>> performSelector:withObject:withObject:] + 77
>> 11  UIKit                               0x019542c0 -[UIApplication
>> sendAction:to:from:forEvent:] + 96
>> 12  UIKit                               0x01954258 -[UIApplication
>> sendAction:toTarget:fromSender:forEvent:] + 61
>> 13  UIKit                               0x01a15021 -[UIControl
>> sendAction:to:forEvent:] + 66
>> 14  UIKit                               0x01a1557f -[UIControl(Internal)
>> _sendActionsForEvents:withEvent:] + 578
>> 15  UIKit                               0x01a146e8 -[UIControl
>> touchesEnded:withEvent:] + 546
>> 16  UIKit                               0x01c181d3
>> _UIGestureRecognizerUpdate + 7407
>> 17  CoreFoundation                      0x03f77afe
>> __CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION__ + 30
>> 18  CoreFoundation                      0x03f77a3d __CFRunLoopDoObservers
>> + 381
>> 19  CoreFoundation                      0x03f557c2 __CFRunLoopRun + 1106
>> 20  CoreFoundation                      0x03f54f44 CFRunLoopRunSpecific +
>> 276
>> 21  CoreFoundation                      0x03f54e1b CFRunLoopRunInMode +
>> 123
>> 22  GraphicsServices                    0x04f1f7e3 GSEventRunModal + 88
>> 23  GraphicsServices                    0x04f1f668 GSEventRun + 104
>> 24  UIKit                               0x01950ffc UIApplicationMain +
>> 1211
>> at (wrapper managed-to-native)
>> MonoTouch.UIKit.UIApplication.UIApplicationMain
>> (int,string[],intptr,intptr) <IL 0x00056, 0x001f5>
>> at MonoTouch.UIKit.UIApplication.Main (string[],string,string) [0x0004c]
>> in /Developer/MonoTouch/Source/monotouch/src/UIKit/UIApplication.cs:38
>> at Golf.Touch.Application.Main (string[]) [0x00000] in
>> /Users/jmgomez/Dropbox/Projects/golf/GolfMvvM/Golf/Golf.Touch/Main.cs:17
>> at (wrapper runtime-invoke) <Module>.runtime_invoke_void_object
>> (object,intptr,intptr,intptr) <IL 0x00049, 0x0012e>
>> 29  GolfTouch                           0x0006d542
>> mono_jit_runtime_invoke + 722
>> 30  GolfTouch                           0x001d0a1e mono_runtime_invoke +
>> 126
>> 31  GolfTouch                           0x001d4c14 mono_runtime_exec_main
>> + 420
>> 32  GolfTouch                           0x001da005 mono_runtime_run_main
>> + 725
>> 33  GolfTouch                           0x000cabd5 mono_jit_exec + 149
>> 34  GolfTouch                           0x002689c4 main + 1988
>> 35  GolfTouch                           0x00066471 start + 53
>>
>> 2013-04-03 17:22:31.984 GolfTouch[2445:c07] Unhandled managed exception:
>> Selector invoked from objective-c on a managed object of type
>> MonoTouch.UIKit.UIControlEventProxy (0x1432A3B0) that has been GC'ed
>> (System.Exception)
>>   at MonoTouch.ObjCRuntime.Runtime.ConstructNSObject (IntPtr ptr, IntPtr
>> klass) [0x000c4] in
>> /Developer/MonoTouch/Source/monotouch/src/ObjCRuntime/Runtime.cs:284
>>   at MonoTouch.ObjCRuntime.Runtime.GetNSObject (IntPtr ptr) [0x0001f] in
>> /Developer/MonoTouch/Source/monotouch/src/ObjCRuntime/Runtime.cs:328
>>   at MonoTouch.ObjCRuntime.Runtime.GetNSObjectWrapped (IntPtr ptr)
>> [0x00000] in
>> /Developer/MonoTouch/Source/monotouch/src/ObjCRuntime/Runtime.cs:345
>>   at (wrapper native-to-managed)
>> MonoTouch.ObjCRuntime.Runtime:GetNSObjectWrapped (intptr)
>>   at (wrapper managed-to-native)
>> MonoTouch.UIKit.UIApplication:UIApplicationMain (int,string[],intptr,intptr)
>>   at MonoTouch.UIKit.UIApplication.Main (System.String[] args,
>> System.String principalClassName, System.String delegateClassName)
>> [0x0004c] in
>> /Developer/MonoTouch/Source/monotouch/src/UIKit/UIApplication.cs:38
>>   at Golf.Touch.Application.Main (System.String[] args) [0x00000] in
>> /Users/jmgomez/Dropbox/Projects/golf/GolfMvvM/Golf/Golf.Touch/Main.cs:17
>> Stacktrace:
>>
>>
>> Native stacktrace:
>>
>> 0   GolfTouch                           0x000f589c
>> mono_handle_native_sigsegv + 284
>> 1   GolfTouch                           0x0013ba8d sigabrt_signal_handler
>> + 109
>>  2   libsystem_c.dylib                   0x944208cb _sigtramp + 43
>> 3   ???                                 0xffffffff 0x0 + 4294967295
>>  4   libsystem_sim_c.dylib               0x048f557b abort + 140
>> 5   GolfTouch                           0x0027a68b
>> monotouch_unhandled_exception_handler + 283
>>  6   GolfTouch                           0x000f130c
>> mono_invoke_unhandled_exception_hook + 140
>> 7   GolfTouch                           0x000f541a
>> mono_handle_exception_internal + 4154
>>  8   GolfTouch                           0x000f556f
>> mono_handle_exception + 47
>> 9   GolfTouch                           0x001386a2
>> mono_x86_throw_exception + 306
>>  10  ???                                 0x0b5d5f8f 0x0 + 190668687
>> 11  ???                                 0x1051b614 0x0 + 273790484
>>  12  ???                                 0x1051b504 0x0 + 273790212
>> 13  ???                                 0x0b704b64 0x0 + 191908708
>>  14  GolfTouch                           0x0026dbd3
>> get_managed_object_for_ptr + 115
>> 15  GolfTouch                           0x00272ac0 monotouch_trampoline +
>> 448
>>  16  libobjc.A.dylib                     0x041f8705 -[NSObject
>> performSelector:withObject:withObject:] + 77
>> 17  UIKit                               0x019542c0 -[UIApplication
>> sendAction:to:from:forEvent:] + 96
>>  18  UIKit                               0x01954258 -[UIApplication
>> sendAction:toTarget:fromSender:forEvent:] + 61
>> 19  UIKit                               0x01a15021 -[UIControl
>> sendAction:to:forEvent:] + 66
>>  20  UIKit                               0x01a1557f
>> -[UIControl(Internal) _sendActionsForEvents:withEvent:] + 578
>> 21  UIKit                               0x01a146e8 -[UIControl
>> touchesEnded:withEvent:] + 546
>>  22  UIKit                               0x01c181d3
>> _UIGestureRecognizerUpdate + 7407
>> 23  CoreFoundation                      0x03f77afe
>> __CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION__ + 30
>>  24  CoreFoundation                      0x03f77a3d
>> __CFRunLoopDoObservers + 381
>> 25  CoreFoundation                      0x03f557c2 __CFRunLoopRun + 1106
>>  26  CoreFoundation                      0x03f54f44 CFRunLoopRunSpecific
>> + 276
>> 27  CoreFoundation                      0x03f54e1b CFRunLoopRunInMode +
>> 123
>>  28  GraphicsServices                    0x04f1f7e3 GSEventRunModal + 88
>> 29  GraphicsServices                    0x04f1f668 GSEventRun + 104
>>  30  UIKit                               0x01950ffc UIApplicationMain +
>> 1211
>> 31  ???                                 0x105194ad 0x0 + 273781933
>>  32  ???                                 0x10111fd0 0x0 + 269557712
>> 33  ???                                 0x10111bd8 0x0 + 269556696
>>  34  ???                                 0x10111d2e 0x0 + 269557038
>> 35  GolfTouch                           0x0006d542
>> mono_jit_runtime_invoke + 722
>>  36  GolfTouch                           0x001d0a1e mono_runtime_invoke
>> + 126
>> 37  GolfTouch                           0x001d4c14 mono_runtime_exec_main
>> + 420
>>  38  GolfTouch                           0x001da005
>> mono_runtime_run_main + 725
>> 39  GolfTouch                           0x000cabd5 mono_jit_exec + 149
>>  40  GolfTouch                           0x002689c4 main + 1988
>> 41  GolfTouch                           0x00066471 start + 53
>>
>> =================================================================
>> 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.
>> =================================================================
>>
>>
>> Juan M Gómez
>> *Contractor Software Engineer*
>> [email protected]
>>
>>    [image: twitter] <http://twitter.com/_jmgomez_> [image: 
>> linkedIn]<http://es.linkedin.com/in/juamangomalv>
>>
>>
>> _______________________________________________
>> MonoTouch mailing list
>> [email protected]
>> http://lists.ximian.com/mailman/listinfo/monotouch
>>
>>
>
>
> --
> Nic Wise
> t.  +44 7788 592 806 | @fastchicken
> b. http://www.fastchicken.co.nz/
>
_______________________________________________
MonoTouch mailing list
[email protected]
http://lists.ximian.com/mailman/listinfo/monotouch

Reply via email to