Notice (2018-05-24): bugzilla.xamarin.com is now in
Please join us on
Visual Studio Developer Community and in the
Mono organizations on
GitHub to continue tracking issues. Bugzilla will remain
available for reference in read-only mode. We will continue to work
on open Bugzilla bugs, copy them to the new locations
as needed for follow-up, and add the new items under Related
Our sincere thanks to everyone who has contributed on this bug
tracker over the years. Thanks also for your understanding as we
make these adjustments and improvements for the future.
Please create a new report on
Developer Community or GitHub with
your current version information, steps to reproduce, and relevant error
messages or log files if you are hitting an issue that looks similar to
this resolved bug and you do not yet see a matching new report.
See simple example below. The recognizer has a class member reference. It does not help to make the delegate a class method. Tapping the window crashes the app.
I'd need a workaround very urgently :-(
public class Application
static void Main (string args)
// The name AppDelegate is referenced in the MainWindow.xib file.
public partial class AppDelegate : UIApplicationDelegate
// This method is invoked when the application has loaded its UI and its ready to run
public override bool FinishedLaunching (UIApplication app, NSDictionary options)
this.oRec = new UITapGestureRecognizer ();
this.oRec.NumberOfTapsRequired = 1;
private UITapGestureRecognizer oRec;
Forgot to mention: this works in the simulator but crashes on the device!
Tested in MT 4.2 beta and iOS 4.3 and iOS 5 beta 7
And another note: it works if I use
this.oRec.AddTarget ( this, new MonoTouch.ObjCRuntime.Selector ( "ViewTapped:" ) );
[Export( "ViewTapped:" )]
public void ViewTapped ( UIGestureRecognizer sender )
instead of adding an NSAction delegate. So at least I have a workaround.
Confirmed, code in original description works on simulator but crash on devices.
It's a linker issue, using "Don't link" on the device build makes it work.
A [Preserve (Conditional = true)] attribute was missing on the method that called the NSAction (and was [Export]ing the internal selector used). Fixed in master and monotouch-4.2