Bug 53381 - Templated views no longer rendering (as of pre3)
Summary: Templated views no longer rendering (as of pre3)
Alias: None
Product: Forms
Classification: Xamarin
Component: Forms ()
Version: 2.3.4
Hardware: PC Windows
: --- normal
Target Milestone: ---
Assignee: Stephane Delcroix
Depends on:
Reported: 2017-03-16 08:42 UTC by Philipp Sumi
Modified: 2017-04-01 12:44 UTC (History)
5 users (show)

Tags: bug, ios, android, uwp, controltemplate, ac
Is this bug a regression?: Yes
Last known good build: 2.3.4-pre2

repro project (294.07 KB, application/x-zip-compressed)
2017-03-17 17:55 UTC, Jimmy [MSFT]

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 Philipp Sumi 2017-03-16 08:42:47 UTC
Upgrading from pre2 to pre5 (or pre3) causes my UI not to be rendered again on both Android and iOS.

My view's contents were wrapped in a custom control that I use to display overlays, like this:

        <!-- rendered screen contents -->
        <Grid x:Name="LayoutRoot">

The wrapper control inherits ContentView, and is rendered through a control template. As of pre3, the content of my wrapper is no longer rendered. As a result, I'm ending up with just a blank page.

I reduced the control template to this as a repro:

        <ControlTemplate x:Key="MyWrapperTemplate">
                <!-- this should render the contents of my wrapper control -->
                <ContentPresenter  />

        <Style TargetType="controls:MyWrapper">
            <Setter Property="ControlTemplate" Value="{DynamicResource MyWrapperTemplate}" />

And this results in just an empty screen, because the ContentPresenter didn't render anything. Adding other controls than the ContentPresenter to the StackLayout in the control template above causes those to be rendered. It's really just the ContentPresenter.
Comment 1 Jimmy [MSFT] 2017-03-17 17:55:17 UTC
Created attachment 20443 [details]
repro project

I was able to reproduce this issue with the project I am attaching. This is occurring on iOS, Android, and UWP with Forms 2.3.4-pre5. On UWP the issue is worse in that entire control template is not rendered, not just the ContentPresenter. 

This also appears to be a regression in the recent 2.3.4 pre-releases. I am confirming this bug so the team can investigate further.

### Regression Test
2.3.4-pre5  BAD
2.3.4-pre2  GOOD   GOOD
Comment 2 Samantha Houts [MSFT] 2017-03-29 18:46:31 UTC
Should be fixed in 2.3.4=pre6. Thank you!

Comment 3 Philipp Sumi 2017-04-01 12:44:27 UTC
Hi Samantha and Jimmy

Thanks for the note! I can't verify unfortunately, since the CarouselView still crahes with DivideByZeroException on pre6. See here:

Any word on this, btw? I'm stuck on pre2 still. This is starting to make me really nervous, also because I can't test the new releases anymore.