Bug 17299 - After adding an Event to a UIButton in iOS Designer, the Action attribute is not decorated with the Event name in the designer.cs file.
Summary: After adding an Event to a UIButton in iOS Designer, the Action attribute is ...
Alias: None
Product: Xamarin Studio
Classification: Desktop
Component: iOS Designer ()
Version: 4.3.0
Hardware: PC Mac OS
: Normal normal
Target Milestone: 4.2.4 (from master)
Assignee: Alan McGovern
Depends on:
Reported: 2014-01-17 16:11 UTC by Jon Goldberger [MSFT]
Modified: 2014-04-02 19:41 UTC (History)
5 users (show)

Is this bug a regression?: ---
Last known good build:

Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and 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 Links.

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.

Related Links:

Comment 1 Jon Goldberger [MSFT] 2014-01-17 16:11:52 UTC
From case 57836:
The documentation seems to suggest that my problem is the fact that I have not created an Event correctly, but as far as I can tell, I have. I wanted to test the new interface (version 4.3.1 build 3). I have Xcode Version 5.0.2 (5A3005).

I created a NEW project (iOS, iPad with Storyboard, Tabbed)
Compiled and ran in debug. Everything fine as expected.
Launched MainStoryboard.

Added 1 button on the first tab page
Clicked on the Event tab and Created a single touch down event called: “BDown”

FirstView Designer automatically contained the following code:
[GeneratedCodeAttribute ("iOS Designer", "1.0")]
partial void BDown (UIButton sender);

In FirstView Controller, I added: (Note: Intellisence saw and allowed me to create this method)
partial void BDown (UIButton sender)
int a = 0;
and placed a break point on the line a=0;

Ran the app again in DEBUG mode.

at UIApplication.Main (args, null, "AppDelegate”);
the application crashed with the following error message:

Objective-C exception thrown. Name: NSInvalidArgumentException Reason: -[FirstViewController BDown:]: unrecognized selector sent to instance 0xe464fd0

As far as I can see, BDown was defined correctly and used correctly, yet it is not recognized. I changed to this version of Monotouch as I was finding the earlier release version was removing Xcode definitions. 

Any advice would be deeply appreciated.
Comment 2 Jon Goldberger [MSFT] 2014-01-17 16:12:52 UTC
Adding the event name to the Action attribute in the designer.cs file fixes this issue.

[Action ("BDown:")]
Comment 3 Jon Goldberger [MSFT] 2014-01-17 16:21:43 UTC
Checked with a UISegmentedControl. Same thing. Naked Action attribute.
Comment 6 Sadik Ali 2014-03-12 10:16:55 UTC
I have checked this issue on below environments:

All Mac
Xamarin Studio
Version 4.2.4 (build 13)
Version: (Business Edition)
Build Information
Git revision: 575c3e95ccd43e4c066755bda27b698fdfd59e3c
Xamarin addins: 79a1e35d2f486ba15541d74724e764c81878ab16

I have followed below steps to verify this issue:

1. Created iOS project.
2. Open storyboard file on Xcode and added a button with  a single touch down event called BDown11.
3. In designer file automatic added below code:

[Action ("BDown11:")]
partial void BDown11 (MonoTouch.UIKit.UIButton sender);

4 . I removed ("BDown11:") from [Action ("BDown11:")]
5. added  below code: in View Controller file.

	partial void BDown11 (UIButton sender)
			int a = 0;
6. Added break point at line and "int a = 0;" debug application and noticed that exception is generated and break point not hit.

Exception log: https://gist.github.com/Sadik1/9507579
Screen cast: http://screencast.com/t/MmUpevl2hS

Also I noticed that without removing ("BDown11:") from [Action ("BDown11:")] it is working fine.

As per above observation I am reopening this issue.
Comment 7 Alan McGovern 2014-04-02 19:41:24 UTC
It is correct that an error is thrown when you remove '("BDown11:")' from the action. The bug *fix* was to ensure that the value was always inserted.

Closing this issue as fixed as you did verify that the '("BDown11:")' is inserted as expected.