Crash on ResetHeaderFooterHeight

Hello, I've a problem using an sfpopuplayout, that is crashing my app giving an exception. 

This is what I'm currently receiving in appcenter:


and this is the xaml of my popup, that is opened using the Show() method from code behind:

                         x:Name="popupLayout"
                        Closed="popupLayout_Closed"
                        BackgroundColor="Transparent"
                        Padding="0,0,10,0">
                       
                                                            AnimationMode="Zoom"
                                ShowFooter="False"
                                ShowHeader="False"
                                AutoSizeMode="Height"
                                BackgroundColor="Transparent">

                                                                            OverlayOpacity="0"
                                        OverlayColor="Transparent"
                                        BorderColor="Transparent"
                                        BorderThickness="0">
                                       
                                                                                            x:TypeArguments="x:Int32"
                                                Android="20"
                                                iOS="10" />
                                       

                                   
                               
 
                                   
                                                                                    Orientation="Vertical"
                                            BackgroundColor="Transparent"
                                            Margin="0"
                                            Padding="0">
                                           
                                               
                                                                                                            x:TypeArguments="Thickness"
                                                        Android="5"
                                                        iOS="3" />
                                               

                                                                                                    Orientation="Vertical"
                                                    BackgroundColor="{StaticResource BackgroundColor_PopupTips}"
                                                    Margin="0"
                                                    Padding="0">
                                                                                                            Orientation="Horizontal"
                                                        Margin="0"
                                                        Padding="0">
                                                                                                                    Text="{Binding PopupLearnTitle}"
                                                            x:Name="PopupTitleLabel"
                                                            BackgroundColor="{StaticResource BackgroundColor_PopupTips}"
                                                            Style="{StaticResource PopupTitleStyle}"
                                                            TextColor="White"
                                                            HorizontalTextAlignment="Start"
                                                            VerticalTextAlignment="Center">
                                                           
                                                                                                                                    x:TypeArguments="Thickness"
                                                                    Android="10,10,10,5"
                                                                    iOS="10,5,10,2" />
                                                           

                                                       

                                                                                                                    Source="popup_close"
                                                            HorizontalOptions="EndAndExpand"
                                                            VerticalOptions="Start"
                                                            Margin="0,16,10,0">
                                                           
                                                               
                                                           

                                                       
                                                   
 
                                                       
                                                           
                                                               
                                                                   
                                                               

                                                                                                                                    Text="{Binding PopupLearnText}"
                                                                    Style="{StaticResource Regular14}"
                                                                    BackgroundColor="{StaticResource BackgroundColor_PopupTips}"
                                                                    HorizontalTextAlignment="Start"
                                                                    VerticalTextAlignment="Center"
                                                                    TextColor="White" />
                                                           

                                                       

(I can't complete it because the text editor doesn't give me the possibility to paste all the code, but I suspect that the problem could be related to the header parameter that is False).

The popup is included as local control in my xaml, in this way:

 

Can you help us to fix this problem?

Thank you


7 Replies

SS Sivaraman Sivagurunathan Syncfusion Team April 3, 2020 11:26 AM UTC

Hi Fabio, 

Thanks for using Syncfusion controls. 

We have checked your query and code snippets. We have prepared the sample based on your requirement. Include the popup as local control in xaml and enable all property where you have mentioned. But the issue does not reproduce from our side. we have attached the sample for your reference.  You can download the same from the below link. 

Control 

<?xml version="1.0" encoding="UTF-8" ?> 
<sfPopup:SfPopupLayout 
    x:Class="PopupDemo.CustomPop" 
    xmlns:sfPopup="clr-namespace:Syncfusion.XForms.PopupLayout;assembly=Syncfusion.SfPopupLayout.XForms" 
    x:Name="ctrlPopupLayout" 
    Closed="ctrlPopupLayout_Closed" 
    BackgroundColor="Transparent" 
    Padding="0,0,10,0"> 
 
    <sfPopup:SfPopupLayout.PopupView > 
        <sfPopup:PopupView 
                AnimationMode="Zoom" 
                ShowFooter="False" 
                ShowHeader="False" 
                AutoSizeMode="Height" 
                BackgroundColor="Transparent" 
                AppearanceMode="OneButton" > 
            <sfPopup:PopupView.PopupStyle> 
                <sfPopup:PopupStyle OverlayColor="Transparent" OverlayOpacity="0" BorderColor="Transparent" BorderThickness="0"> 
                </sfPopup:PopupStyle> 
            </sfPopup:PopupView.PopupStyle> 
            <sfPopup:PopupView.ContentTemplate> 
                <DataTemplate> 
                    <Label Text="This is SfPopupLayout" BackgroundColor="SkyBlue" 
                           HorizontalTextAlignment="Center"/> 
                </DataTemplate> 
            </sfPopup:PopupView.ContentTemplate> 
        </sfPopup:PopupView> 
    </sfPopup:SfPopupLayout.PopupView> 
</sfPopup:SfPopupLayout> 

Page 

<?xml version="1.0" encoding="utf-8" ?> 
             xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" 
             xmlns:d="http://xamarin.com/schemas/2014/forms/design" 
             mc:Ignorable="d" 
             xmlns:controls="clr-namespace:PopupDemo;assembly=PopupDemo" 
             xmlns:sfPopup="clr-namespace:Syncfusion.XForms.PopupLayout;assembly=Syncfusion.SfPopupLayout.XForms" 
             x:Class="PopupDemo.MainPage"> 
    <StackLayout> 
        <Button Text="Open" Clicked="ClickToShowPopup_Clicked"/> 
        <controls:CustomPop x:Name="PopUp"/> 
    </StackLayout> 
 
</ContentPage> 

 



In case, if the issue still persists at your side, please do revert us with a modified sample to reproduce the issue with proper replication procedure. 
 
Regards, 
Sivaraman S 
 



FG Fabio Giacomelli April 3, 2020 03:49 PM UTC

Thank you for your reply.
The only difference that I see is that you declared an empty function:

  private void ctrlPopupLayout_Closed(object sender, EventArgs e)
        {

        }

while in my code I do this in the same handler (as you suggested in another thread):

 private void popupLayout_Closed(object sender, EventArgs e)
        {
            this.IsVisible = false;
        }

could it be the problem for my crash?

thank you


SS Sivaraman Sivagurunathan Syncfusion Team April 6, 2020 10:57 AM UTC

Hi Fabio, 
 
Thanks for your update. 
 
As per your update, we have set the IsVisible as false in Closed event.  But the issue does not reproduce from our side. So we have checked the issue based on your call stack. So we have planned to provide the test patch.  Please let us know your Syncfusion version. So that, we have provide the test patch in that version. 
 
Regards, 
Sivaraman S 
 



FG Fabio Giacomelli April 16, 2020 07:37 AM UTC

We are using version 17.4.0.55 at this time. Do you plan to release a fix in the next version?


KK Karthikraja Kalaimani Syncfusion Team April 17, 2020 12:21 PM UTC

Hi Fabio,

We have created a test patch in the version 17.4.0.55. Kindly check the issue with the custom assemblies and revert us whether the issue is fixed or not.

Please find the custom assemblies by the following link, 
   

Installation Direction:  
These assemblies should replace the existing assemblies in the following location.    
 
{Syncfusion Installed location}\Essential Studio\17.1.0.47\Xamarin\lib\pcl\ Syncfusion.SfPopupLayout.XForms.dll             
{Syncfusion Installed location}\Essential Studio\17.1.0.47\Xamarin\lib\android\ Syncfusion.SfPopupLayout.XForms.Android.dll                 


Note : This patch is created only for testing purposes not exact fix.

Regards,
Karthik Raja 



FG Fabio Giacomelli May 8, 2020 03:07 PM UTC

We have some news about this problem.

We found that every time the Show method of popup was called, and it has not already finished its work, i.e. because the popup is creating the animation, and in the meantime we called a navigation to another page, i.e. tapping on another tab in the shell, the popup crashes with this stacktrace:


05-08 16:43:25.657 I/MonoDroid( 5789): UNHANDLED EXCEPTION:

05-08 16:43:25.658 I/MonoDroid( 5789): System.NullReferenceException: Object reference not set to an instance of an object.

05-08 16:43:25.658 I/MonoDroid( 5789):   at (wrapper dynamic-method) Android.Runtime.DynamicMethodNameCounter.123(intptr,intptr,bool,int,int,int,int)

05-08 16:43:25.658 I/MonoDroid( 5789):   at (wrapper native-to-managed) Android.Runtime.DynamicMethodNameCounter.123(intptr,intptr,int,int,int,int,int)

05-08 16:43:25.658 I/MonoDroid( 5789):   at (wrapper managed-to-native) Java.Interop.NativeMethods.java_interop_jnienv_call_nonvirtual_void_method_a(intptr,intptr&,intptr,intptr,intptr,intptr)

05-08 16:43:25.658 I/MonoDroid( 5789):   at Java.Interop.JniEnvironment+InstanceMethods.CallNonvirtualVoidMethod (Java.Interop.JniObjectReference instance, Java.Interop.JniObjectReference type, Java.Interop.JniMethodInfo method, Java.Interop.JniArgumentValue* args) [0x00079] in <26521a5118b44c858c385715922b9d5d>:0 

05-08 16:43:25.658 I/MonoDroid( 5789):   at Java.Interop.JniPeerMembers+JniInstanceMethods.InvokeVirtualVoidMethod (System.String encodedMember, Java.Interop.IJavaPeerable self, Java.Interop.JniArgumentValue* parameters) [0x0005d] in <26521a5118b44c858c385715922b9d5d>:0 

05-08 16:43:25.658 I/MonoDroid( 5789):   at Android.Widget.LinearLayout.OnLayout (System.Boolean changed, System.Int32 l, System.Int32 t, System.Int32 r, System.Int32 b) [0x00079] in <4ccdb3137d974856b786e1aeebbfbab6>:0 

05-08 16:43:25.658 I/MonoDroid( 5789):   at Syncfusion.XForms.Android.PopupLayout.PopupView.OnLayout (System.Boolean changed, System.Int32 left, System.Int32 top, System.Int32 right, System.Int32 bottom) [0x00000] in <e84e062dd9b74317bc54be79266539eb>:0 

05-08 16:43:25.658 I/MonoDroid( 5789):   at Android.Widget.LinearLayout.n_OnLayout_ZIIII (System.IntPtr jnienv, System.IntPtr native__this, System.Boolean changed, System.Int32 l, System.Int32 t, System.Int32 r, System.Int32 b) [0x00009] in <4ccdb3137d974856b786e1aeebbfbab6>:0 

05-08 16:43:25.658 I/MonoDroid( 5789):   at (wrapper dynamic-method) Android.Runtime.DynamicMethodNameCounter.119(intptr,intptr,bool,int,int,int,int)


I already tried to check if the Popup instance is not null before call the Show, but it doesn't help, because the popup object is not already disposed, but probably something in its implementation do. 

You can see attached here a screenshot of what I see on the screen when the crash happens, the popup hasn't finished to show but I already tapped on a new page.


I tried with your custom libraries provided but the problem is not solved.



Attachment: screen_ce670d88.zip


KK Karthikraja Kalaimani Syncfusion Team May 11, 2020 11:52 AM UTC

Hi Fabio,

We have created a new incident under your Direct trac account. We suggest you to follow up with the incident for further updates. Please log in using the below link. 

 

Regards,
Karthik Raja
 


Loader.
Up arrow icon