Bug 15250 - Runtime issue calling a callback block in Xamarin iOS Binding project.
Summary: Runtime issue calling a callback block in Xamarin iOS Binding project.
Alias: None
Product: iOS
Classification: Xamarin
Component: XI runtime ()
Version: 6.0.x
Hardware: Macintosh Mac OS
: --- normal
Target Milestone: Untriaged
Assignee: Rolf Bjarne Kvinge [MSFT]
Depends on:
Reported: 2013-10-07 15:48 UTC by Fernando
Modified: 2013-10-10 15:34 UTC (History)
3 users (show)

Tags: xamarin runtime blockcallback callback bock ios binding
Is this bug a regression?: ---
Last known good build:

Objective C project and Xamarin solution replicating the issue. (492.80 KB, application/x-zip-compressed)
2013-10-07 15:48 UTC, Fernando

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 Fernando 2013-10-07 15:48:00 UTC
Created attachment 5079 [details]
Objective C project and Xamarin solution replicating the issue.

  We are having the issue described here http://stackoverflow.com/questions/19188924/xamarin-binding-to-ios-block

  iOS passes a block to C# that is later on called from C#, the block gets called but it seems to have lost the context, ie: local variables that are supposed to have values get the values lost.

  Attached is the complete Xamarin project replicating the issue. Also, XCode project used to create the static library was included.

Comment 1 Rolf Bjarne Kvinge [MSFT] 2013-10-08 06:07:43 UTC
Thanks for the perfect test case.

The problem is that we take an NSStackBlock and store it in heap memory. We need to copy that to a NSMallocBlock.
Comment 2 Fernando 2013-10-08 07:41:21 UTC

Any idea when it will be fixed?

Will we get notified when it is fixed?
Comment 3 Rolf Bjarne Kvinge [MSFT] 2013-10-08 08:43:55 UTC
I can't promise any date it'll be fixed (hopefully soon, I believe I know how to do it), but I'll be notified here when it happens.
Comment 4 Rolf Bjarne Kvinge [MSFT] 2013-10-08 08:44:27 UTC
You'll be notified too :)
Comment 5 Rolf Bjarne Kvinge [MSFT] 2013-10-10 10:37:49 UTC

At this point I do not know yet which release will contain the fix (but the bug # will be listed in the corresponding release notes).

monotouch/master: 9b55b2f49d77e29877802d4742c82e477ea8ebdd.
Comment 6 Fernando 2013-10-10 15:34:33 UTC
Great! thanks!