Bug 60617 - StaticResource crashes inside Grid's RowDefinition when using XamlCompilation(XAMLC)
Summary: StaticResource crashes inside Grid's RowDefinition when using XamlCompilation...
Status: RESOLVED DUPLICATE of bug 59818
Alias: None
Product: Forms
Classification: Xamarin
Component: Forms ()
Version: 2.4.0
Hardware: Macintosh Mac OS
: --- normal
Target Milestone: ---
Assignee: Stephane Delcroix
Depends on:
Reported: 2017-11-10 13:05 UTC by cristinagioanca03
Modified: 2017-11-10 20:23 UTC (History)
2 users (show)

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

Sample project (1.17 MB, application/zip)
2017-11-10 13:05 UTC, cristinagioanca03

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 cristinagioanca03 2017-11-10 13:05:02 UTC
Created attachment 25636 [details]
Sample project

I have recently started using XAML compiler to increase the performance of my Xamarin.Forms apps, by adding: [assembly: XamlCompilation (XamlCompilationOptions.Compile)] in my App's code behind. Unfortunately, I have come across a problem. I have created a simple test project to use as an example and I attached it. 

 I am using the Application's ResourceDictionary to create a global value for heights, as well as for colors, to reuse throughout my pages. The color works just fine, but when I try using {StaticResource height}, of type double, inside the Grid, it crashes. It happens anywhere inside of the Grid (be it on the Row/Column Definition, or directly on its elements}. The same {StaticResource height} works fine anywhere outside of the Grid, such as in the StackLayout below. 

 The error displays the following message: System.InvalidCastException: Specified cast is not valid, and it doesn't give too much specific information. It took me a while to realise where the problem came from. Could you, please, take a look at this problem? I must mention that the code behaves well and throws no exception if I am not using the XAML compiler.
Comment 2 Stephane Delcroix 2017-11-10 20:23:18 UTC

*** This bug has been marked as a duplicate of bug 59818 ***