Bug 58922 - OnIdiom fails for x:Double
Summary: OnIdiom fails for x:Double
Status: RESOLVED ANSWERED
Alias: None
Product: Forms
Classification: Xamarin
Component: Forms ()
Version: 2.3.5
Hardware: PC Windows
: --- normal
Target Milestone: ---
Assignee: Stephane Delcroix
URL:
: 60283 60452 ()
Depends on:
Blocks:
 
Reported: 2017-08-21 10:51 UTC by Michael Rumpler
Modified: 2018-03-05 15:56 UTC (History)
9 users (show)

Tags:
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 ANSWERED

Description Michael Rumpler 2017-08-21 10:51:13 UTC
I have this code in my app.xaml:

	<x:Double x:Key="IconColumnWidth">
		<OnIdiom x:TypeArguments="x:Double" Phone="30" Tablet="40" />
	</x:Double>

This worked totally fine in XF 2.3.4 but with 2.3.5 or later I get

    Can not set the content of x:Double as it doesn't have a ContentPropertyAttribute

I do use XamlC and get this as a compile error.

GOOD: 2.3.4.267
BAD:  2.3.5.233-pre1
BAD:  2.4.0.266-pre1
Comment 2 Michael Rumpler 2017-08-22 08:07:28 UTC
I rewrote it as

    <OnIdiom x:Key="IconColumnWidth" x:TypeArguments="x:Double" Phone="30" Tablet="40" />

This seems to work also with the newest versions.
Comment 3 Mirko Da Corte 2017-08-25 13:09:30 UTC
I'm trying to set Grid.HeightRequest value and I receive this compile error:

"No property, bindable property, or event found for 'HeightRequest', or mismatching type between value and property."

The code:
	<Grid.HeightRequest>
		<OnIdiom x:TypeArguments="x:Double"
				 Phone="320"
				 Tablet="480" />
	</Grid.HeightRequest>

I get this exception also with other cases, also with OnPlatform in Xaml.

It's thrown with x:Double, x:Boolean and ImageSource passing strings. It worked before
Comment 4 Mirko Da Corte 2017-08-26 01:05:57 UTC
Errata: issue in my case is only for x:Double and x:Boolean types. ImageSource was an other issue in my code.
Comment 5 Stephane Delcroix 2017-09-04 10:07:37 UTC
@Michael: this used to work, but no longer does, just like it is for OnPlatform. Your workaround is the correct one, sorry for the inconvenience.

@Mirko: I can't reproduce your issue, and even added a unit-test for it (that's passing) https://github.com/xamarin/Xamarin.Forms/commit/110a1355900ffec5977fcb6684ee9ba7311ec2dd
Comment 6 Paul DiPietro [MSFT] 2017-10-20 00:43:33 UTC
*** Bug 60283 has been marked as a duplicate of this bug. ***
Comment 7 safakoktem 2017-10-20 02:04:11 UTC
@Michael how exactly did you solved? 

I tried the following codes in my project but no lucky

<controls:LImage.WidthRequest>
                <OnIdiom x:Key="WidthRequest" x:TypeArguments="x:Double" Phone="60" Tablet="200" Desktop="200"/>
</controls:LImage.WidthRequest>

Thanks
Comment 8 Michael Rumpler 2017-10-20 06:11:24 UTC
As I wrote in Comment 2, I removed the <x:Double> element. You already use the notation which works for me.

You seem to have the same problem as Mirko. Maybe you file a separate bug with your issue. Please also add a repro project as Stephane could not reproduce it.
Comment 9 harel123 2017-11-05 10:00:09 UTC
I am also experiencing a similar issue. Filed a bug report here: https://bugzilla.xamarin.com/show_bug.cgi?id=60452 that maybe can be considered a duplicate of this one
Comment 10 harel123 2017-11-05 10:00:51 UTC
Any solution I could find on this bug report didn't solve my issue.
Comment 11 Paul DiPietro [MSFT] 2017-11-17 18:30:07 UTC
*** Bug 60452 has been marked as a duplicate of this bug. ***
Comment 12 Paul DiPietro [MSFT] 2017-11-19 14:57:37 UTC
*** Bug 60757 has been marked as a duplicate of this bug. ***
Comment 13 harel123 2017-11-20 08:27:44 UTC
I suggest changing the status to something else and not RESOLVED ANSWERED since I am experiencing a similar issue and none of the replies on this bug report helped me solve it.
Comment 14 Stephane Delcroix 2017-11-20 10:31:11 UTC
please test again against 2.5 or our nightly. We have a unit test for that https://github.com/xamarin/Xamarin.Forms/commit/110a1355900ffec5977fcb6684ee9ba7311ec2dd and it passes
Comment 15 harel123 2017-11-20 12:49:41 UTC
I tested with Xamarin.Forms 2.5.0.91635 , results seem to be the same - the issue is still there for me. I would also like to point out that I'm using dot NET Standard 2.0 and not PCL.
Comment 16 Stephane Delcroix 2017-11-20 13:42:28 UTC
@harel123: please reopen your original ticket as soon as you have a repro project you can attach, as requested by https://bugzilla.xamarin.com/show_bug.cgi?id=60452#c2
Comment 17 Ian 2017-12-04 19:20:59 UTC
Just to chime in. I get the same error after moving from PCL to .NET Standard 2

I use Forms 2.5.0.91635

For me it's:

                        <Label.FontSize>
                            <OnIdiom x:TypeArguments="x:Double"
                                     Phone="26"
                                     Tablet="36" />
                        </Label.FontSize>

However, if I remove that, then it's another setting and so on.

Unable to build.
Comment 18 Leo 2017-12-07 16:12:27 UTC
Ian, try to just remove the 'x:TypeArguments="x:Double"'. It worked for me.
Comment 19 Leo 2017-12-07 16:15:41 UTC
Forget about it, it just changed the error message... this is getting really frustrating :/
Comment 20 Paul DiPietro [MSFT] 2018-03-05 15:56:49 UTC
*** Bug 60452 has been marked as a duplicate of this bug. ***