Bug 2529 - Could not parse expression '[Action ("btn_Start_Click:")]'
Summary: Could not parse expression '[Action ("btn_Start_Click:")]'
Status: RESOLVED FIXED
Alias: None
Product: Xamarin Studio
Classification: Desktop
Component: Text Editor ()
Version: 2.8.4.1
Hardware: PC Mac OS
: Low normal
Target Milestone: master
Assignee: Mike Krüger
URL:
Depends on:
Blocks:
 
Reported: 2011-12-15 11:00 UTC by Jeffrey Stedfast
Modified: 2015-08-20 03:24 UTC (History)
2 users (show)

Tags:
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:
Status:
RESOLVED FIXED

Description Jeffrey Stedfast 2011-12-15 11:00:20 UTC
From the MonoTouch mailing-list:

I have an updated project (from Xcode 3 to Xcode 4.2.1). When I create a new
ViewController and define a button on this(with outlet and action) it does
not work.
I tried:
this.btn_Start.TouchUpInside+=(sender,e)=>{....} in ViedDidLoad as well as
partial void btn_Start_Click (UIButton sender)
But when you click the button, nothing happens - not even an error message.
There is an Outlet and an Action in the .designer.cs file:
[Outlet]
MonoTouch.UIKit.UIButton btn_Start { get; set; }

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

I set a breakpoint and when I hover over the Action in the designer file,
the message-bubble says:
"Could not parse expression'[Action ("btn_Start_Click:")]'

when I hover over this.btn_Start.TouchUpInside+= the bubble says: 'Unknown
member:'TouchUpInside'
Comment 1 Jeffrey Stedfast 2011-12-15 13:26:11 UTC
Okay, so I've just written up a simple app that does what you instructed:

1. Hooking up an Action via Xcode:

If you opt for this method, you need to implement partial void btn_Start_Click (MonoTouch.UIKit.UIButton sender) in your non-designer file, basically all MonoDevelop has done is stub out the method prototype.

Hoving the mouse over the [Action ...] attribute, I get a different error in the tooltip:

global::MonoTouch.Foundation.ActionAttribute: Unknown member: Foundation

The resolver is probably confused, thinking that MonoTouch is the variable and Foundation is a member or something funky. This might be resolved in the 'newresolver' branch which rewrote the resolver to be a lot better at this sort of stuff.

In any event, when I click the Start button in my iPhone app, my breakpoint in my own btn_Start_Clicked() method does get hit.



2. Hooking up an event handler via a delegate

You are right. Somehow the intellisense resolver is not providing TouchUpInside (or nearly *any* of the UIButton members) completion value in the list when you type this.btn_Start. - the completion list contains only a few items.



#2 is something Mike will need to take a look at.

#1 is something he and I will likely both need to look at, as he's the resolver guy and I'm the one working on the debugger UI stuff, and #1 is a mix of the two.
Comment 2 Jörg Schanko 2011-12-19 02:14:26 UTC
So, the part with the btn_Start_Click() method not beeing hit was my fault. I had a GestureRecognizer on the page and that one got hit every  time you pressed the button.
The rest remains true.
Even my problem with UIBarButtonItems not working remains after upgrading to MonoTouch 5.ß.4 ans MonoDevelop 2.8.5
Comment 3 Jeffrey Stedfast 2011-12-19 08:49:49 UTC
What was the UIBarButtonItem issue? I don't recall hearing about that one. (you should probably submit a new bug report for that one).
Comment 4 Jörg Schanko 2011-12-19 09:13:37 UTC
Posted this in the forum - with no reply:





I'm updating an older project now with MonoTouch 5.0.3 and MonoDevelop 2.8.4.2. 
Everything works - except UIBarButtonItems. 
In XCode, the .h file looks like: 

@interface vcTimerChoose : UIViewController { 
        
        UITableView *_myTableView; 
        
} 

@property (retain, nonatomic) IBOutlet UIBarButtonItem *BarButton; 

@property (nonatomic, retain) IBOutlet UITableView *myTableView; 

- (IBAction)BarButton_Click:(id)sender; 
@end 

(pretty much the same as in the older VC in my project), but it doesn't work. 
When I try to compile the project 
partial void BarButton_Click (MonoTouch.UIKit.UIBarButtonItem sender) 
gives a "A partial method 'ShoCoIP.vcTimerChoose.BarButton_Click((MonoTouch.UIKit.UIBarButtonItem)' implementation is missing a partial declaration" error and
 BarButton.Title=NSBundle.MainBundle.LocalizedString("Settings","Timer Settings");
 throws a "System.NullReferenceException: Object reference not set to an instance of an object" exception, though the exct same code works in other viewController in the same project (created with an older version of MonoTouch).
 
Any idea??? 
Thx, Jörg
Comment 5 Jeffrey Stedfast 2011-12-19 12:10:46 UTC
This sounds like a separate issue. Can you open a new bug report and, if possible, attach a test project that exhibits this broken behavior?

If you don't have a sample project to attach, can you attach the .designer.cs file for vcTimerChoose? Perhaps it will give us a lead.
Comment 6 Jörg Schanko 2011-12-19 15:49:50 UTC
done.
http://bugzilla.xamarin.com/show_bug.cgi?id=2575

Cheers, Jörg
Comment 7 Mike Krüger 2012-02-27 03:28:50 UTC
Should work in nr branch.