Xamarin.forms: Migrate to .NET Standard - Can't compile XAML

Created on 5 Dec 2017  路  16Comments  路  Source: xamarin/Xamarin.Forms

I have included a Repro.

I converted a working PCL app (X.Forms 2.5) to .NET Standard (Runs on X.Forms 2.5 as well)

On only 1 XAML I get the error:
"No property, bindable property, or event found for 'FontSize', or mismatching type between value and property"

To reproduce the error.

Create a .NET Standard 2 project with XForms 2.4 or 2.5, fails on both. Add this "Login.xaml" page. Attempt to compile.

If you Comment out the Labels and it compiles.


<?xml version="1.0" encoding="utf-8"?>

<ContentPage xmlns="http://xamarin.com/schemas/2014/forms" xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"

         x:Class="CoApp.Views.Test.LoginPageD"
         Title="Login">



<Grid>
    <!---BACKGROUND IMAGE-->


    <!-- TIP: We use a scrollview so that if the password is too low, when the keyboard appears, Forms will automatically scroll it into view -->
    <ScrollView
         >
        <!-- MAIN CONTAINER -->
        <Grid
            ColumnSpacing="0"
            RowSpacing="0"
            HorizontalOptions="Fill"
            VerticalOptions="FillAndExpand">

            <Grid.RowDefinitions>
                <RowDefinition Height="120" />
                <RowDefinition Height="Auto" />
                <RowDefinition Height="*" />
                <RowDefinition Height="Auto" />
            </Grid.RowDefinitions>

            <!-- LOGO -->
            <Grid
                Grid.Row="0"
                WidthRequest="60"
                HeightRequest="60"
                Margin="20"
                VerticalOptions="End"
                HorizontalOptions="Start">

                <Image HorizontalOptions="Start" VerticalOptions="Center" WidthRequest="95" HeightRequest="95"
                       Source="icon.png" Aspect="AspectFill" />
            </Grid>


            <!--CLAIM TEXT-->
            <StackLayout
                Grid.Row="1"
                Spacing="10"
                Padding="20,10"
                Orientation="Vertical"
                VerticalOptions="Center">
                <Label 
                    LineBreakMode="WordWrap"

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

                <Label
                    LineBreakMode="WordWrap"
                    Text="Login using your email and password."

                    VerticalTextAlignment="Center">
                    <Label.FontSize>
                        <OnIdiom x:TypeArguments="x:Double"
                                 Phone="17"
                                 Tablet="27" />
                    </Label.FontSize>
                </Label>

                <BoxView

                    />

            </StackLayout>


            <!---FIELDS CONTAINER-->
            <Grid
                Grid.Row="2"
                Padding="20,0"
                ColumnSpacing="0"
                RowSpacing="0"
                VerticalOptions="CenterAndExpand"
                HeightRequest="180">


                <StackLayout
                    Grid.Row="0"
                    VerticalOptions="StartAndExpand">
                    <StackLayout.Spacing>
                        <OnPlatform x:TypeArguments="x:Double">
                            <On Platform="Android">20</On>
                            <On Platform="iOS">40</On>
                        </OnPlatform>
                    </StackLayout.Spacing>
                    <!---EMAIL FIELD-->
                    <Entry
                        AutomationId="txtEmail"
                        Placeholder="E-mail"
                        >



                    </Entry>

                    <!---PASSWORD FIELD-->
                    <Entry
                        AutomationId="txtPassword"
                        Placeholder="Password"

                        IsPassword="true"

                        VerticalOptions="StartAndExpand" >

                    </Entry>


                </StackLayout>


            </Grid>


        </Grid>
    </ScrollView>

</Grid>

netstandard bug

Most helpful comment

Dude, the Xamarin Forms PM is answering bugs? That鈥檚 so cool.

I鈥檓 a MVP and that still impresses...

All 16 comments

Confirmed on 2.5.0.91635 only when XAMLC enabled:

[XamlCompilation(XamlCompilationOptions.Compile)]

It's fixed on master testing nightly build 2.5.1.102606-nightly

Dude, the Xamarin Forms PM is answering bugs? That鈥檚 so cool.

I鈥檓 a MVP and that still impresses...

is there a work around for this? I can't use the nightly builds

@StephaneDelcroix @davidortinau

There's no workaround, unless you want to disable XamlC.

This is not a regression, and we do not support netstandard projects on XF 2.5, so it's very unlikely that we'll release a service release for that.

If you want to build your own binaries for 2.5, you can cherry-pick the fix from master.

This is not a regression, and we do not support netstandard projects on XF 2.5, so it's very unlikely that we'll release a service release for that.

we apparently support net standard project since 2.4. I missed that

Does vNext mean a new XForms 2.5xxx version ?

This is not a regression, and we do not support netstandard projects on XF 2.5, so it's very unlikely that we'll release a service release for that.

@StephaneDelcroix It is a regression, I have a .NetStandard project working with X.F 2.4.280, upgrading to 2.5.xxx breaks my build

@abrasat this has been moved to vCurrent, and should be part of the next 2.5 service release

@bruzkovsky the OP mentions this is failing on both 2.4 and 2.5. Your issue might be different. In that case, open a new issue

@StephaneDelcroix Ok thanks, I read over that part... I also use XamlC, so I will evaluate if the fix already does it for me

why dont you just make small release and fix this problem for all of us?

why dont you just make small release and fix this problem for all of us?

There is a SR3 with the fix in it, but it is not on nuget.org:

https://github.com/xamarin/Xamarin.Forms/releases/download/release-2.5.0-sr3/Xamarin.Forms.2.5.0.122203.nupkg

Can someone upload that please @davidortinau

@bruzkovsky Version 2.5.0.122203 seems to be avaiable through nuget.

@MarcusSpecht You are right. It just takes a really long time until the versions are listed on nuget. SR4 was released yesterday, still no sign on nuget... 馃槙

<OnPlatform x:TypeArguments="x:Boolean"
                                         iOS="false"
                                         Android="true"/>

Position 23:22. No property, bindable property, or event found for 'HasShadow', or mismatching type between value and property.

Tried with Xamarin Forms 2.5.0.280555 and 2.5.0.122203, Can't Build the Project after converting from PCL to .NET Standard.

@muhaym please open a new issue with your repro attached. thanks

@StephaneDelcroix Is there any way to share repo offline. Since I am not able to recreate the issue in fresh project

Was this page helpful?
0 / 5 - 0 ratings