ListViewRenderer.onDetachedFromWindow: Java.IO.JavaLocationException

One of our testers reported a bug where our app crashed if an SfPopupView that contained a SfListView was open when navigating away from a page using the NavigationPage soft back button on Android:

Stack traces

  • Java.Lang.Error: Exception of type 'Java.Lang.Error' was thrown.
  • java.lang.Error: Java callstack:
  • crc643f46942d9dd1fff9.ListViewRenderer.n_onDetachedFromWindow(Native Method)
  • crc643f46942d9dd1fff9.ListViewRenderer.onDetachedFromWindow ListViewRenderer.java:57
  • android.view.View.dispatchDetachedFromWindow View.java:17498
  • android.view.ViewGroup.dispatchDetachedFromWindow ViewGroup.java:3701
  • android.view.ViewGroup.removeViewInternal ViewGroup.java:5245
  • android.view.ViewGroup.removeViewAt ViewGroup.java:5192
  • crc64720bb2db43a66fe9.FragmentContainer.n_onDestroyView(Native Method)
  • crc64720bb2db43a66fe9.FragmentContainer.onDestroyView FragmentContainer.java:49
  • androidx.fragment.app.Fragment.performDestroyView Fragment.java:3200
  • androidx.fragment.app.FragmentStateManager.destroyFragmentView FragmentStateManager.java:742
  • androidx.fragment.app.FragmentStateManager.moveToExpectedState FragmentStateManager.java:346
  • androidx.fragment.app.SpecialEffectsController$FragmentStateManagerOperation.complete SpecialEffectsController.java:745
  • androidx.fragment.app.SpecialEffectsController$Operation.completeSpecialEffect SpecialEffectsController.java:672
  • androidx.fragment.app.DefaultSpecialEffectsController$SpecialEffectsInfo.completeSpecialEffect DefaultSpecialEffectsController.java:776
  • androidx.fragment.app.DefaultSpecialEffectsController.startAnimations DefaultSpecialEffectsController.java:141
  • androidx.fragment.app.DefaultSpecialEffectsController.executeOperations DefaultSpecialEffectsController.java:120
  • androidx.fragment.app.SpecialEffectsController.executePendingOperations SpecialEffectsController.java:297
  • androidx.fragment.app.FragmentManager.executeOpsTogether FragmentManager.java:2202
  • androidx.fragment.app.FragmentManager.removeRedundantOperationsAndExecute FragmentManager.java:2100
  • androidx.fragment.app.FragmentManager.execPendingActions FragmentManager.java:2002
  • androidx.fragment.app.FragmentManager$5.run FragmentManager.java:524
  • android.os.Handler.handleCallback Handler.java:790
  • android.os.Handler.dispatchMessage Handler.java:99
  • android.os.Looper.loop Looper.java:164
  • android.app.ActivityThread.main ActivityThread.java:6494
  • java.lang.reflect.Method.invoke(Native Method)
  • com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run RuntimeInit.java:440
  • com.android.internal.os.ZygoteInit.main ZygoteInit.java:807
  • TypeManager.CreateProxy (System.Type type, System.IntPtr handle, Android.Runtime.JniHandleOwnership transfer)
  • TypeManager.CreateInstance (System.IntPtr handle, Android.Runtime.JniHandleOwnership transfer, System.Type targetType)
  • TypeManager.CreateInstance (System.IntPtr handle, Android.Runtime.JniHandleOwnership transfer, System.Type targetType)
  • Object.GetObject (System.IntPtr handle, Android.Runtime.JniHandleOwnership transfer, System.Type type)
  • Object._GetObject[T] (System.IntPtr handle, Android.Runtime.JniHandleOwnership transfer)
  • Object.GetObject[T] (System.IntPtr handle, Android.Runtime.JniHandleOwnership transfer)
  • Object.GetObject[T] (System.IntPtr jnienv, System.IntPtr handle, Android.Runtime.JniHandleOwnership transfer)
  • View.n_OnDetachedFromWindow (System.IntPtr jnienv, System.IntPtr native__this)
  • JNINativeWrapper.Wrap_JniMarshal_PP_V (_JniMarshal_PP_V callback, System.IntPtr jnienv, System.IntPtr klazz)

5 Replies

LN Lakshmi Natarajan Syncfusion Team June 24, 2022 01:32 PM UTC

Hi Andrew,


We have tested our sample based on the details given. Unfortunately, we are unable to replicate the reported scenario on our end.


Could you please share the following details which will be helpful for us to check on it and provide you with the best possible solution at the earliest?


  • ListView and navigation related code snippets
  • Issue replication video
  • Tested device details
  • Syncfusion and Xamarin.Forms versions


Also, we have attached our tested sample in this update. Please check our sample and let us know if you are still facing the same issue. If not, please modify our sample based on your scenario and revert us with the replication sample.


Regards,

Lakshmi Natarajan



Attachment: ListViewXamarin_778547ff.zip


AH Andrew Hoke June 24, 2022 03:02 PM UTC

Hi Lakshmi, here are some more details:

  • Syncfusion NuGet: 19.3.0.46
  • Xamarin.Forms: 5.0.0.2337
  • Device: LG V20
  • OS: Android Oreo 8.1.0
Navigation is performed by Xamarin upon press of the soft back button in the navigation bar in the app.

ListView code snippet (contained in AbsoluteLayout):

<sfpv:SfPopupLayout AbsoluteLayout.LayoutBounds="0,0,1,1"

                    AbsoluteLayout.LayoutFlags="All"

                    IsOpen="{Binding IsScheduledActivityFilterPopupShowing}"

                    IsVisible="{Binding IsScheduledActivityFilterPopupShowing}">

    <sfpv:SfPopupLayout.PopupView>

        <sfpv:PopupView HeightRequest="125"

                        ShowFooter="False"

                        ShowHeader="False">

            <sfpv:PopupView.ContentTemplate>

                <DataTemplate>

                    <ListView ItemsSource="{Binding ScheduledActivityFilterListItems}"

                              SeparatorVisibility="None">

                        <ListView.Behaviors>

                            <xtk:EventToCommandBehavior Command="{Binding ScheduledActivityItemSelectedCommand}"

                                                        EventArgsConverter="{StaticResource SelectedItemChangedEventArgsConverter}"

                                                        EventName="ItemSelected" />

                        </ListView.Behaviors>

                    </ListView>

                </DataTemplate>

            </sfpv:PopupView.ContentTemplate>

        </sfpv:PopupView>

    </sfpv:SfPopupLayout.PopupView>

</sfpv:SfPopupLayout>


I will be doing a round of NuGet package updating and will report back if updating packages fixes the issue.



SV Suja Venkatesan Syncfusion Team June 28, 2022 12:37 PM UTC

Hi Andrew,


We regret let you know that we are unable to replicate the reported scenario on our end. We have prepared a simple sample with provided code snippets and version details, attached here for your reference. We have checked the provided exception stacktrace, we didn’t found exception from syncfusion controls, its related to Xamarin.Forms ListView. Could please confirm further you are facing issue while loading Xamarin.Forms.ListView or SfListview as content of SfPopupLayout ? Please revert to us with modified sample to replicate the reported issue on our end. It will be more helpful for us to provide the timely solutions. We will wait to hear from you about whether updating nuget packages resolves the issue.


Regards,

Suja



Attachment: ListViewXamarin_77eae064.zip


AH Andrew Hoke June 28, 2022 01:59 PM UTC

Hi Suja,

I was also unable to reproduce the issue. I will follow up with the tester who reported the issue and ask them to verify if the exception can still be reproduced.



LN Lakshmi Natarajan Syncfusion Team June 29, 2022 01:45 PM UTC

Hi Andrew,


Thank you for the update.


Please check the reported scenario on your end and get back to us if you need further assistance. We will be happy to assist you.


Regards,

Lakshmi Natarajan



Loader.
Up arrow icon