Bug 37441 - XAML compiler on attributes with multiple values fails
Summary: XAML compiler on attributes with multiple values fails
Status: VERIFIED FIXED
Alias: None
Product: Forms
Classification: Xamarin
Component: Forms ()
Version: 2.0.0
Hardware: PC Windows
: Normal normal
Target Milestone: ---
Assignee: Stephane Delcroix
URL:
Depends on:
Blocks:
 
Reported: 2016-01-06 09:14 UTC by abel_vilalta
Modified: 2016-01-19 18:33 UTC (History)
6 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:
VERIFIED FIXED

Description abel_vilalta 2016-01-06 09:14:11 UTC
Using the XAML compiler on attributes with multiple values fails (only tested on absolute layout):

<AbsoluteLayout BackgroundColor="Maroon">
            <BoxView BackgroundColor="Gray" AbsoluteLayout.LayoutBounds="0,0,1,100" 
            		 AbsoluteLayout.LayoutFlags="XProportional,YProportional,WidthProportional" />
</AbsoluteLayout>


gives an error that enum is not defined for the multiple values of layout flags:


Error: Position 14:16. Enum value not found for XProportional,YProportional,WidthProportional
Comment 1 Stephane Delcroix 2016-01-06 16:48:50 UTC
I think we solved this one already... checking
Comment 2 Kevin B 2016-01-13 00:14:52 UTC
I too ran into this issue with the following xaml:

<AbsoluteLayout xmlns="http://xamarin.com/schemas/2014/forms"
                xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml">
    <BoxView Color="Fuchsia" AbsoluteLayout.LayoutFlags="PositionProportional" AbsoluteLayout.LayoutBounds="0.5,0.5,40,40" />
</AbsoluteLayout>

As a work around you can switch from attribute syntax to element syntax. This provides type knowledge so that the Xaml compiler can create the correct type. In attribute syntax, when the Xaml is interpreted at run-time, it relies on the type converter to translate the string to the desired type. 

Something like this:
<AbsoluteLayout xmlns="http://xamarin.com/schemas/2014/forms"
                xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml">
    <BoxView Color="Fuchsia" AbsoluteLayout.LayoutFlags="PositionProportional">
        <AbsoluteLayout.LayoutBounds>
            <Rectangle X="0.5" Y="0.5" Height="40" Width="40" />
        </AbsoluteLayout.LayoutBounds>
    </BoxView>
</AbsoluteLayout>
Comment 3 Parmendra Kumar 2016-01-13 14:25:25 UTC
I have tried to reproduce this issue but not able to reproduce this issue. I have followed the code provided in bug description and comment #2 and after using these code my app deploy successfully on device,

Screencast: http://www.screencast.com/t/0wA5bXzmds

Please follow the screencast and let me know If I have missed anything to reproduce this issue.

Environment info:

Xamarin.Forms.2.0.0.6482

Microsoft Visual Studio Professional 2013
Version 12.0.30723.00 Update 3
Microsoft .NET Framework
Version 4.6.01055

Installed Version: Professional

Xamarin   4.0.1.69 (21aad62)
Visual Studio extension to enable development for Xamarin.iOS and Xamarin.Android.

Xamarin.Android   6.0.1.5 (50280e4)
Visual Studio plugin to enable development for Xamarin.Android.

Xamarin.iOS   9.4.1.20 (122b860)
Visual Studio extension to enable development for Xamarin.iOS.

Xamarin.iOS Unified Migration   1.0
Automated migration for Xamarin iOS Classic projects to Unified
Comment 4 Kevin B 2016-01-13 16:59:33 UTC
Thank you for looking at this. After a full clean and recompile the code I posted in comment #2 appears to be working. Sorry for any inconvenience.
Comment 5 Parmendra Kumar 2016-01-14 12:00:00 UTC
Thanks @Kevin,

As per comment #4 closing this issue.

@abel, Could you please check this issue with latest forms version or clean the solution and please feel free to reopen this issue if you getting same issue as mentioned in bug description.

Thanks.
Comment 6 abel_vilalta 2016-01-18 21:04:47 UTC
Hi,

    Yes.Thanks...Looks it is working...I cannot understand what I was doing wrong...Or there were some old files not properly compiled.

Cheers
Comment 7 abel_vilalta 2016-01-18 21:05:42 UTC
Maybe I was using an old version on Forms...
Comment 8 Parmendra Kumar 2016-01-19 18:33:09 UTC
As per comment #6 and comment #7, I am closing this issue.


Thanks.