How to Fix Xamarin exception: Foundation.MonoTouchException

<>
 Xamarin exception: Foundation.MonoTouchException


Some of the iOS/Android developers while trying to develop app with Xamarin are facing issue with running app on the simulator. As soon as you will compile and run the app, it will load find on the simulator but when you will do some action on the app, the program crashes Main.cs file. Infect the issue is so common that for many developers the issue appeared right away with first sample test app development of Xamarin WebSite. 
Xamarin will throw an exception “Foundation.MonoTouchException” with below details.

xamarin crash stack


Failed at UIApplication.Main (args, null, "AppDelegate"); with the following error message "an unhandled exception has occurred”.

Full Stack of the xamarin app is :

Objective-C exception thrown.  Name: NSInvalidArgumentException Reason: -[ViewController TranslateButton_TouchUpInside:]: unrecognized selector sent to instance 0x7fda24d13a20
Native stack trace:
0   CoreFoundation                      0x000000010eac229b __exceptionPreprocess + 331
1   libobjc.A.dylib                     0x000000011b29d735 objc_exception_throw + 48
2   CoreFoundation                      0x000000010eae0fa4 -[NSObject(NSObject) doesNotRecognizeSelector:] + 132
3   UIKitCore                           0x0000000124616163 -[UIResponder doesNotRecognizeSelector:] + 287
4   CoreFoundation                      0x000000010eac6fb6 ___forwarding___ + 1446
5   CoreFoundation                      0x000000010eac8e88 _CF_forwarding_prep_0 + 120
6   UIKitCore                           0x00000001242307c3 -[UIApplication sendAction:to:from:forEvent:] + 83
7   UIKitCore                           0x0000000124368e85 -[UIControl sendAction:to:forEvent:] + 67
8   UIKitCore                           0x00000001243691a2 -[UIControl _sendActionsForEvents:withEvent:] + 450
9   UIKitCore                           0x00000001243680e6 -[UIControl touchesEnded:withEvent:] + 583
10  UIKitCore                           0x0000000124a43334 -[UIWindow _sendTouchesForEvent:] + 2729
11  UIKitCore                           0x0000000124a44a30 -[UIWindow sendEvent:] + 4080
12  UIKitCore                           0x000000012424ae10 -[UIApplication sendEvent:] + 352
13  UIKitCore                           0x00000001241830d0 __dispatchPreprocessedEventFromEventQueue + 3024
14  UIKitCore                           0x0000000124185cf2 __handleEventQueueInternal + 5948
15  CoreFoundation                      0x000000010ea25b31 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 17
16  CoreFoundation                      0x000000010ea25464 __CFRunLoopDoSources0 + 436
17  CoreFoundation                      0x000000010ea1fa4f __CFRunLoopRun + 1263
18  CoreFoundation                      0x000000010ea1f221 CFRunLoopRunSpecific + 625
19  GraphicsServices                    0x000000011f31a1dd GSEventRunModal + 62
20  UIKitCore                           0x000000012422f115 UIApplicationMain + 140
21  ???                                 0x000000013fe8ac0e 0x0 + 5367180302
22  ???                                 0x000000013fe8a9a3 0x0 + 5367179683


How to fix this crash :


-> One simple way to fix this crash is to re create the Button you are pressing on the simulator while running the app and making a crash.

Simply delete the button and create a new one with same property. It will fix the issue permanently.

Comments

MC

Amazon Ads