Bug 39312 - [UWP] OnIdiom.Desktop property does not exist.
Summary: [UWP] OnIdiom.Desktop property does not exist.
Status: RESOLVED FIXED
Alias: None
Product: Forms
Classification: Xamarin
Component: Windows (show other bugs)
Version: 2.0.0
Hardware: PC Mac OS
: Normal enhancement
Target Milestone: ---
Assignee: Bugzilla
URL:
Depends on:
Blocks:
 
Reported: 2016-03-03 01:12 UTC by Jon Goldberger [MSFT]
Modified: 2017-01-25 08:47 UTC (History)
5 users (show)

See Also:
Tags: ac
Is this bug a regression?: ---
Last known good build:


Attachments
test project (286.71 KB, application/zip)
2016-03-03 01:12 UTC, Jon Goldberger [MSFT]
Details

Description Jon Goldberger [MSFT] 2016-03-03 01:12:14 UTC
Created attachment 15232 [details]
test project

## Description

Although there is a new Device.Idiom for Desktop [1] and a TargetIdiom.Desktop [2], there is no Desktop property for OnIdiom [3].

[1] https://developer.xamarin.com/guides/xamarin-forms/platform-features/device/
[2] https://developer.xamarin.com/api/type/Xamarin.Forms.TargetIdiom/
[3] https://developer.xamarin.com/api/type/Xamarin.Forms.OnIdiom%3CT%3E/

As such the following fails:

><OnIdiom x:TypeArguments="View">
><OnIdiom.Phone>
><Label Text="Phone"></Label>
></OnIdiom.Phone>
>
><OnIdiom.Tablet>
><Label Text="Tablet"></Label>
></OnIdiom.Tablet>
>
><OnIdiom.Desktop> <!-- fails -->
><Label Text="Desktop"></Label>
></OnIdiom.Desktop>
></OnIdiom>
></ContentView.Content>

with exception: "No Property name of Desktop found"
 
Checking the Device.Idiom in the running UWP app does return "Desktop". 


## Steps to reproduce

1. Open attached sample project and set the UWP app as the startup project. 

2.Deploy to simulator (or Local presumably)

Expect result: App will launch and show "Desktop" label.

Actual result: App crashes with exception:

>Xamarin.Forms.Xaml.XamlParseException was unhandled by user code
>  HResult=-2146233088
>  Message=Position 16:14. No Property of name Desktop found
>  Source=Xamarin.Forms.Xaml
>  StackTrace:
>       at Xamarin.Forms.Xaml.ApplyPropertiesVisitor.SetPropertyValue(Object xamlelement, XmlName propertyName, Object value, BindableObject rootElement, INode node, HydratationContext context, IXmlLineInfo lineInfo)
>       at Xamarin.Forms.Xaml.ApplyPropertiesVisitor.Visit(ElementNode node, INode parentNode)
>       at Xamarin.Forms.Xaml.ElementNode.Accept(IXamlNodeVisitor visitor, INode parentNode)
>       at Xamarin.Forms.Xaml.ElementNode.Accept(IXamlNodeVisitor visitor, INode parentNode)
>       at Xamarin.Forms.Xaml.ElementNode.Accept(IXamlNodeVisitor visitor, INode parentNode)
>       at Xamarin.Forms.Xaml.RootNode.Accept(IXamlNodeVisitor visitor, INode parentNode)
>       at Xamarin.Forms.Xaml.XamlLoader.Load(BindableObject view, String xaml)
>       at Xamarin.Forms.Xaml.XamlLoader.Load(BindableObject view, Type callingType)
>       at Xamarin.Forms.Xaml.Extensions.LoadFromXaml[TView](TView view, Type callingType)
>       at App1.Page1.InitializeComponent()
>       at App1.Page1..ctor()
>       at App1.App..ctor()
>       at App1.UWP.MainPage..ctor()
>       at App1.UWP.App1_UWP_XamlTypeInfo.XamlTypeInfoProvider.Activate_4_MainPage()
>       at App1.UWP.App1_UWP_XamlTypeInfo.XamlUserType.ActivateInstance()


## Notes

Tested with Xamarin Forms 2.0.0.6482 and 2.1.0.6524. Same results. 

## Environment

Microsoft Visual Studio Professional 2015
Version 14.0.23107.0 D14REL
Microsoft .NET Framework
Version 4.6.01038

Installed Version: Professional

Visual Basic 2015   00322-40000-00000-AA850
Microsoft Visual Basic 2015

Visual C# 2015   00322-40000-00000-AA850
Microsoft Visual C# 2015

Visual C++ 2015   00322-40000-00000-AA850
Microsoft Visual C++ 2015

Visual F# 2015 RC   00322-40000-00000-AA850
Microsoft Visual F# 2015 RC

Windows Phone SDK 8.0 - ENU   00322-40000-00000-AA850
Windows Phone SDK 8.0 - ENU

Application Insights Tools for Visual Studio Package   1.0
Application Insights Tools for Visual Studio

ASP.NET and Web Tools   14.0.20626.0
ASP.NET and Web Tools

ASP.NET Web Frameworks and Tools 2013   5.2.30624.0
For additional information, visit http://www.asp.net/

Common Azure Tools   1.5
Provides common services for use by Azure Mobile Services and Microsoft Azure Tools.

GenerateUnitTest   1.0
Generates unit test code for methods in classes under test.

GitHub.VisualStudio   1.0
A Visual Studio Extension that brings the GitHub Flow into Visual Studio.

Microsoft Azure Mobile Services Tools   1.4
Microsoft Azure Mobile Services Tools

NuGet Package Manager   3.2.0
NuGet Package Manager in Visual Studio. For more information about NuGet, visit http://docs.nuget.org/.

PreEmptive Analytics Visualizer   1.2
Microsoft Visual Studio extension to visualize aggregated summaries from the PreEmptive Analytics product.

SQL Server Data Tools   14.0.50616.0
Microsoft SQL Server Data Tools

Visual Studio Tools for Universal Windows Apps   14.0.23309.00 d14oob
The Visual Studio Tools for Universal Windows apps allow you to build a single universal app experience that can reach every device running Windows 10: phone, tablet, PC, and more. It includes the Microsoft Windows 10 Software Development Kit.

Xamarin   4.0.1.96 (dcea9c1)
Visual Studio extension to enable development for Xamarin.iOS and Xamarin.Android.

Xamarin.Android   6.0.1.10 (e98e962)
Visual Studio plugin to enable development for Xamarin.Android.

Xamarin.iOS   9.4.1.24 (47eb74b)
Visual Studio extension to enable development for Xamarin.iOS.
Comment 2 Stephane Delcroix 2017-01-25 08:47:16 UTC
see https://github.com/xamarin/Xamarin.Forms/pull/420

fixed in 2.3.4-pre1

Note You need to log in before you can comment on or make changes to this bug.