Bug 30177 - Argument 8 of Action and Func delegates is null in 64-bit only for static delegates
Summary: Argument 8 of Action and Func delegates is null in 64-bit only for static del...
Alias: None
Product: iOS
Classification: Xamarin
Component: XI runtime ()
Version: XI 8.10
Hardware: PC Mac OS
: --- normal
Target Milestone: Untriaged
Assignee: Bugzilla
Depends on:
Reported: 2015-05-17 23:06 UTC by Adam Kemp
Modified: 2015-05-22 12:48 UTC (History)
3 users (show)

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

Test case (173.35 KB, application/zip)
2015-05-17 23:06 UTC, Adam Kemp

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 Adam Kemp 2015-05-17 23:06:43 UTC
Created attachment 11230 [details]
Test case

In 8 argument delegates if nothing is captured then argument 8 is lost. This only seems to happen on 64-bit ARM targets, and only for argument 8 of 8 argument delegates. Delegates with more arguments don't have the problem, and any delegate that captures anything also doesn't have the problem.

For example, in this code h will be null:

            Action<string, string, string, string, string, string, string, string> test = (a, b, c, d, e, f, g, h) =>
                // h is always null
                Console.WriteLine("{0} {1}", g, h);
            test("a", "b", "c", "d", "e", "f", "g", "h");

In this alternative example h will not be null:

            var captured = "captured";
            Action<string, string, string, string, string, string, string, string> test = (a, b, c, d, e, f, g, h) =>
                Console.WriteLine("{0} {1}", captured, h);
            test("a", "b", "c", "d", "e", "f", "g", "h");

The same applies to non-lambda delegates. That is, if you assign a static function to the Action variable then it will lose argument 8, but assigning a non-static function does not lose argument 8.

Adding one extra argument fixes the issue.

The attached project has an example reproduction of this issue. See the AppDelegate class.

Version info:

=== Xamarin Studio ===

Version 5.9.1 (build 3)
Installation UUID: 5262c8cb-ead0-41f7-926c-685725d7430e
	Mono 4.0.0 ((detached/d136b79)
	GTK+ 2.24.23 (Raleigh theme)

	Package version: 400000143

=== Apple Developer Tools ===

Xcode 6.3.1 (7703)
Build 6D1002

=== Xamarin.iOS ===

Version: (Business Edition)
Hash: 6481535
Branch: master
Build date: 2015-04-27 04:38:13-0400

=== Xamarin.Android ===

Version: (Business Edition)
Android SDK: /Users/adam/Library/Developer/Xamarin/android-sdk-mac_x86
	Supported Android versions:
		2.3   (API level 10)
		4.0.3 (API level 15)
		4.4   (API level 19)
		5.0   (API level 21)
Java SDK: /usr
java version "1.7.0_71"
Java(TM) SE Runtime Environment (build 1.7.0_71-b14)
Java HotSpot(TM) 64-Bit Server VM (build 24.71-b01, mixed mode)

=== Xamarin Android Player ===

Version: Unknown version
Location: /Applications/Xamarin Android Player.app

=== Xamarin.Mac ===

Not Installed

=== Build Information ===

Release ID: 509010003
Git revision: aad75a6e7e48f18120ce41f47d0ff2c6216f49c3
Build date: 2015-05-08 12:46:18-04
Xamarin addins: 1246b3044cbb7f56a217334f8fc5489ef8eefe3f

=== Operating System ===

Mac OS X 10.10.3
Darwin varlamov.local 14.3.0 Darwin Kernel Version 14.3.0
    Mon Mar 23 11:59:05 PDT 2015
    root:xnu-2782.20.48~5/RELEASE_X86_64 x86_64
Comment 1 Sebastien Pouliot 2015-05-18 10:30:38 UTC
That sounds like an ARM64 ABI issue. Zoltan can you have a look ?
Comment 2 Zoltan Varga 2015-05-18 11:26:49 UTC
Fixed in mono-extensions 8c3f96fc91671a6478894c1c8a4ab79ed06c9cf2. This could be a candidate for a service release.
Comment 3 Abhishek 2015-05-22 12:48:22 UTC
I have checked this issue with Master build 
monotouch- Now this issue is working fine .Here is the screencast for the same.

Hence closing this issue.