Bug 34521 - Relative layout add child ambiguious call error
Summary: Relative layout add child ambiguious call error
Status: RESOLVED NOT_ON_ROADMAP
Alias: None
Product: Forms
Classification: Xamarin
Component: Forms ()
Version: 1.5.0
Hardware: PC Windows
: --- normal
Target Milestone: ---
Assignee: Bugzilla
URL:
Depends on:
Blocks:
 
Reported: 2015-10-02 09:57 UTC by FieldstrikeMobile
Modified: 2016-05-06 10:31 UTC (History)
5 users (show)

Tags: ngf ac api
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 NOT_ON_ROADMAP

Description FieldstrikeMobile 2015-10-02 09:57:16 UTC
Adding a child to a relative layout in code causes an ambiguous call error:

            Grid helpBar = new Grid()
            _layout = new RelativeLayout
            {
                VerticalOptions = LayoutOptions.FillAndExpand,
                HorizontalOptions = LayoutOptions.FillAndExpand
            };
            _layout.Children.Add(helpBar);

Error:

Error	27	The call is ambiguous between the following methods or properties: 'Xamarin.Forms.RelativeLayout.IRelativeList<Xamarin.Forms.View>.Add(Xamarin.Forms.View, Xamarin.Forms.Constraint, Xamarin.Forms.Constraint, Xamarin.Forms.Constraint, Xamarin.Forms.Constraint)' and 'Xamarin.Forms.RelativeLayout.IRelativeList<Xamarin.Forms.View>.Add(Xamarin.Forms.View, System.Linq.Expressions.Expression<System.Func<double>>, System.Linq.Expressions.Expression<System.Func<double>>, System.Linq.Expressions.Expression<System.Func<double>>, System.Linq.Expressions.Expression<System.Func<double>>)'	D:\tfs\FieldStrike\FieldStrikeMove\FieldStrikeMove.Forms\CustomControls\HelpContentPage.cs	31	13	FieldStrikeMove.Forms


Caused because of the two methods:

  void Add(T view, Constraint xConstraint = null, Constraint yConstraint = null, Constraint widthConstraint = null, Constraint heightConstraint = null);
            void Add(T view, Expression<Func<double>> x = null, Expression<Func<double>> y = null, Expression<Func<double>> width = null, Expression<Func<double>> height = null);
Comment 1 Jason Smith [MSFT] 2016-04-13 19:37:46 UTC
Thank you for your report. At this time there are no plans to implement any changes around this issue.

Warm regards,
Xamarin Forms Team
Comment 2 C64Gamer 2016-05-06 10:31:27 UTC
Having the same problem?

Button btn = new Button ();
btn.Text = "Debug Test";
btn.BackgroundColor = Color.Red;

RelativeLayout layout = companyRepro;
layout.Children.Add(btn);

Error CS0121: The call is ambiguous between the following methods or properties: `Xamarin.Forms.RelativeLayout.IRelativeList<Xamarin.Forms.View>.Add(Xamarin.Forms.View, System.Linq.Expressions.Expression<System.Func<double>>, System.Linq.Expressions.Expression<System.Func<double>>, System.Linq.Expressions.Expression<System.Func<double>>, System.Linq.Expressions.Expression<System.Func<double>>)' and `Xamarin.Forms.RelativeLayout.IRelativeList<Xamarin.Forms.View>.Add(Xamarin.Forms.View, Xamarin.Forms.Constraint, Xamarin.Forms.Constraint, Xamarin.Forms.Constraint, Xamarin.Forms.Constraint)'

Is there a workaround? Don't want to rewrite my whole layout.