Bug 58717 - <On/> tag doesn't work on UWP when .Net native tool chain is On
Summary: <On/> tag doesn't work on UWP when .Net native tool chain is On
Alias: None
Product: Forms
Classification: Xamarin
Component: Windows ()
Version: 2.3.4
Hardware: PC Windows
: Normal normal
Target Milestone: ---
Assignee: Bugzilla
Depends on:
Reported: 2017-08-11 10:38 UTC by Stanislav
Modified: 2017-09-11 21:20 UTC (History)
4 users (show)

Tags: on tag, .net native toolchain, uwp, ac
Is this bug a regression?: ---
Last known good build:

Sample solution (281.86 KB, application/x-zip-compressed)
2017-08-11 10:38 UTC, Stanislav

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 Stanislav 2017-08-11 10:38:50 UTC
Created attachment 24140 [details]
Sample solution

Seems like newly introduced <On> tag for setting value depending on platform doesn't work on UWP with .Net native tool chain enabled:

For example if we set TextColor this way :

                   <OnPlatform x:TypeArguments="Color">
                        <On Platform="Android">Green</On>
                        <On Platform="Windows">Red</On>
                        <On Platform="iOS">Green</On>

value is not applied to the control,

but if we declare it using deprecated <OnPlatform> tag 
                 <OnPlatform x:TypeArguments="Color">

everything works fine

This behavior is true for Xamarin.Forms still not fixed in Xamarin.Forms

Sample solution is attached
Comment 1 Paul DiPietro [MSFT] 2017-08-14 01:38:49 UTC
Thank you for the reproduction. My machine is personally not showing a difference regardless of whether the native tooling is on or not, but I am on an insider build of Windows 10 so that might have something to do with it. iOS does work for both labels, however, to compare. I'll set this to confirmed for now until further investigation.
Comment 2 halilgoecer 2017-08-25 00:20:05 UTC
I have the same issue
Comment 3 Jimmy [MSFT] 2017-09-11 21:20:14 UTC
I tested this with Xamarin.Forms 2.4.0-pre2 and it appears to be fixed. Note that the "Windows" platform has been split into "WinRT" and "UWP". When using <On /> and "UWP" in the sample project, both Labels now look the same even when "Compile with .NET Native tool chain" is enabled.