Bug 14165 - Linker Link All erases all ParamArrayAttribute attributes from method metadata
Summary: Linker Link All erases all ParamArrayAttribute attributes from method metadata
Alias: None
Product: iOS
Classification: Xamarin
Component: Tools ()
Version: 6.4.0
Hardware: Macintosh Mac OS
: --- normal
Target Milestone: Untriaged
Assignee: Sebastien Pouliot
Depends on:
Reported: 2013-08-21 16:54 UTC by Ben Cooley
Modified: 2013-08-29 16:22 UTC (History)
3 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:

Description Ben Cooley 2013-08-21 16:54:00 UTC
When using "Link All" in Xamarin iOS, any variable argument list method such as:

public void Foo(params object[] args) {

Will have the [ParamArray] attribute erased from it's method information metadata.

This test will confirm:

	public class Test {
		public void TestArgs(params object[] args) {
			System.Diagnostics.Debug.WriteLine ("args test");
	public override bool FinishedLaunching (UIApplication app, NSDictionary options)
		window = new UIWindow (UIScreen.MainScreen.Bounds);
		viewController = new TestParamArrayViewController ();
		window.RootViewController = viewController;
		window.MakeKeyAndVisible ();

		// Get attribute
		var paramAttr = new ParamArrayAttribute ();

		// Do test..
		var t = new Test ();
		t.TestArgs ("aaa", "bbb", "ccc");

		// Check for ParamArrayAttribute
		var methodInfo = typeof(Test).GetMethod ("TestArgs");
		var paramInfo = methodInfo.GetParameters () [0];
		var attribs = paramInfo.GetCustomAttributes ();
		foreach (var attrib in attribs) {
			System.Diagnostics.Debug.WriteLine (attrib.GetType ().FullName);

		return true;

This makes it impossible for the PlayScript AOT runtime to correctly detect that a method has a variable argument list and break apart the arguments in a dynamic call into an object array.

This means that the "Link All" option will automatically break any PlayScript app.
Comment 1 Sebastien Pouliot 2013-08-21 17:08:47 UTC
Fixed in master / dea25bc68b2434bfe5d8a57c18ebe18cd86820c1
Comment 2 PJ 2013-08-29 16:22:39 UTC
Verified the included test case passes on X.I I did slightly modify the case by adding 'true' as an argument for GetCustomAttributes, as without it it wouldn't compile.

On both Don't Link and LinkAll, attrib.GetType().FullName returns System.ParamArrayAttribute.

Verification environment:
iPhone 5, iOS 6.1.4
XS 4.0.12/1b2e128
Xcode 4.6.3
Mono 3.2/a0fc6ba
OSX 10.8.4