Bug 15283 - Binding a objective-c method with a block doesn't compile anymore in Xamarin.iOS but was working in
Summary: Binding a objective-c method with a block doesn't compile anymore in Xamarin....
Alias: None
Product: iOS
Classification: Xamarin
Component: General ()
Version: 7.0.0.x
Hardware: Macintosh Mac OS
: --- normal
Target Milestone: Untriaged
Assignee: Bugzilla
Depends on:
Reported: 2013-10-08 13:19 UTC by Alexandre Pepin
Modified: 2013-10-10 17:57 UTC (History)
4 users (show)

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

Sample project that reproduces the problem (3.36 KB, application/zip)
2013-10-08 13:19 UTC, Alexandre Pepin

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:

Description Alexandre Pepin 2013-10-08 13:19:16 UTC
Created attachment 5092 [details]
Sample project that reproduces the problem

When compiling the attached project, I get the following error : 

"<path>/BindingTests/obj/Debug/ios/ObjCRuntime/Trampolines.g.cs(12,12): Error CS0029: Cannot implicitly convert type `System.IntPtr' to `MonoTouch.Foundation.NSObject' (CS0029) (BindingTests)"

It was working under Xamarin.iOS but doesn't work anymore under Xamarin.iOS The project compile if I changed the returned type of "MyBlockToBind" to void or if the parameter of "MyBlockToBind" isn't an array...
Comment 1 Sebastien Pouliot 2013-10-08 15:23:34 UTC
That's likely related to the introduction, in 7.0, of the new [BlockCallback] attribute [1]. What does the native side definition looks like?

Comment 2 Alexandre Pepin 2013-10-08 15:54:53 UTC
Objective-c : 
typedef id (^MyBlockToBind)(NSArray* keys);
- (void) testMethodBlock: (MyBlockToBind)myBlockToBind;

I still get the same compilation error when i add the [BlockCallback] attribute : 
void TestMethod ([BlockCallback] MyBlockToBind myBlockToBind);
Comment 3 Rolf Bjarne Kvinge [MSFT] 2013-10-10 17:57:33 UTC

maccore/master: d5e84e9306cc50fd1f65b55e8c21c4ec949f43b4
monotouch/master: a7f4ee72ea8423f69530c9a72d83859e9a18cea8