Bug 58159 - XamlParseException when setting a Forms.Grid layout's ColumnDefinitions on .xaml
Summary: XamlParseException when setting a Forms.Grid layout's ColumnDefinitions on .xaml
Status: RESOLVED ANSWERED
Alias: None
Product: Forms
Classification: Xamarin
Component: Forms ()
Version: 2.3.4
Hardware: PC Windows
: --- normal
Target Milestone: ---
Assignee: Bugzilla
URL:
Depends on:
Blocks:
 
Reported: 2017-07-14 12:11 UTC by Álvaro Fernández Neira
Modified: 2017-08-21 18:03 UTC (History)
2 users (show)

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


Attachments
Project with the aforementioned issue (1.83 MB, application/x-rar)
2017-07-17 11:01 UTC, Álvaro Fernández Neira
Details


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 Álvaro Fernández Neira 2017-07-14 12:11:29 UTC
When setting a Xamarin.Forms.Grid's ColumnDefinitions attributes through the .xaml code, the app crashes on a real Windows Phone 10 device, but it doesn't crash on Android nor iOS (neither on emulators nor real devices) nor on Visual Studio's Windows Phone 8 and 10 emulators.

This is the exception:
Position 13:14. Cannot assign property "ColumnDefinitions": Property does not exists, or is not assignable, or mismatching type between value and property

It also crashes if a RowDefinition is given a name in the .xaml, and again, only on a real device.

This is the whole .xaml:
<?xml version="1.0" encoding="utf-8" ?>
<ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
             xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
             xmlns:local="clr-namespace:WindowsPhoneTest"
             x:Class="WindowsPhoneTest.MainPage">
    <Grid x:Name="grid"
          HorizontalOptions="FillAndExpand"
          VerticalOptions="FillAndExpand">
        <Grid.RowDefinitions>
            <RowDefinition Height="*"/>
        </Grid.RowDefinitions>
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="*"/>
        </Grid.ColumnDefinitions>
    </Grid>
</ContentPage>
Comment 1 Paul DiPietro [MSFT] 2017-07-14 14:50:49 UTC
I'm unable to reproduce this with the provided XAML, nor when adding x:Name to a RowDefinition, running on a Lumia device with Windows 10 on it. Can you upload your project/reproduction so we can run it against a device to see if the behavior is different? Are you on a specific version of Forms, and have you checked against latest prerelease builds as well? The last suggestion would be the deletion of bin/obj/package folders as is common. I will just set this to needinfo for the time being.
Comment 2 Álvaro Fernández Neira 2017-07-14 15:42:54 UTC
I won't have access to the computer Xamarin is installed in until Monday, so I won't be able to upload it until then. The solution itself was just the empty cross platform (Xamarin.Forms) template with an added Windows 8 RT project (following https://developer.xamarin.com/guides/xamarin-forms/platform-features/windows/installation/phone/) and the xaml code I posted replacing the default code of MainPage.

I was using Xamarin.Forms 2.3.4.247 for all the projects of the solution (Android, iOS and Windows Phone projects), but I didn't try checking against other releases, although I did try emptying the bin, obj and package with the same results.
Comment 3 Álvaro Fernández Neira 2017-07-17 11:01:21 UTC
Created attachment 23592 [details]
Project with the aforementioned issue

Uploaded the project.
Comment 4 Álvaro Fernández Neira 2017-07-21 09:03:05 UTC
Found the issue, and it was on my side.

I didn't add these lines to the WinPhone project's AssemblyInfo.cs file:
using Xamarin.Forms.Xaml;
[assembly: XamlCompilation(XamlCompilationOptions.Compile)]
Comment 5 Paul DiPietro [MSFT] 2017-08-21 18:03:52 UTC
Setting to resolved per the above comment.