Bug 53381

Summary: Templated views no longer rendering (as of pre3)
Product: Forms Reporter: Philipp Sumi <hardcodet>
Component: FormsAssignee: Stephane Delcroix <stephane.delcroix>
Status: RESOLVED FIXED    
Severity: normal CC: david, jas, jimmy.garrido, sahou, stephane.delcroix
Priority: ---    
Version: 2.3.4   
Target Milestone: ---   
Hardware: PC   
OS: Windows   
Tags: bug, ios, android, uwp, controltemplate, ac Is this bug a regression?: Yes
Last known good build: 2.3.4-pre2
Attachments: repro project

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:

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


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">
            <StackLayout>
                <!-- this should render the contents of my wrapper control -->
                <ContentPresenter  />
            </StackLayout>
        </ControlTemplate>


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


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
2.3.3.193   GOOD
Comment 2 Samantha Houts [MSFT] 2017-03-29 18:46:31 UTC
Should be fixed in 2.3.4=pre6. Thank you!

https://github.com/xamarin/Xamarin.Forms/pull/831
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:
https://bugzilla.xamarin.com/show_bug.cgi?id=53382

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.