App crashes when trying to reload a TabbedPage

Hello! 

We are using SfPdfView version: 19.1.0.66. We are having an issue probably caused by an unloading error. 

We are doing the following steps:

  • Opening a TabbedPage with Pdf's in which one of them, then navigating to another page;
  • When trying to open again the TabbedPage with these Pdf's, the app is crashing and we get the Stack Trace below.

Obs.:  We are using the Loading and Unloading calls in the OnAppearing/OnDisappearing methods.


Stack Trace:

SfPdfDocumentViewRenderer.OnElementChanged (Xamarin.Forms.Platform.Android.ElementChangedEventArgs`1[TElement] e)

System.ObjectDisposedException: Cannot access a closed Stream.

UnmanagedMemoryStream.set_Position (System.Int64 value)

SfPdfDocumentViewRenderer.OnElementChanged (Xamarin.Forms.Platform.Android.ElementChangedEventArgs`1[TElement] e)

VisualElementRenderer`1[TElement].SetElement (TElement element)

IVisualElementRenderer.SetElement (Xamarin.Forms.VisualElement element)

Platform.CreateRenderer (Xamarin.Forms.VisualElement element, Android.Content.Context context)

VisualElementPackager.AddChild (Xamarin.Forms.VisualElement view, Xamarin.Forms.Platform.Android.IVisualElementRenderer oldRenderer, Xamarin.Forms.Platform.Android.RendererPool pool, System.Boolean sameChildren)

VisualElementPackager.SetElement (Xamarin.Forms.VisualElement oldElement, Xamarin.Forms.VisualElement newElement)

VisualElementPackager.Load ()

VisualElementRenderer`1[TElement].SetPackager (Xamarin.Forms.Platform.Android.VisualElementPackager packager)

VisualElementRenderer`1[TElement].SetElement (TElement element)

IVisualElementRenderer.SetElement (Xamarin.Forms.VisualElement element)

Platform.CreateRenderer (Xamarin.Forms.VisualElement element, Android.Content.Context context)

VisualElementPackager.AddChild (Xamarin.Forms.VisualElement view, Xamarin.Forms.Platform.Android.IVisualElementRenderer oldRenderer, Xamarin.Forms.Platform.Android.RendererPool pool, System.Boolean sameChildren)

VisualElementPackager.SetElement (Xamarin.Forms.VisualElement oldElement, Xamarin.Forms.VisualElement newElement)

VisualElementPackager.Load ()

VisualElementRenderer`1[TElement].SetPackager (Xamarin.Forms.Platform.Android.VisualElementPackager packager)

VisualElementRenderer`1[TElement].SetElement (TElement element)

IVisualElementRenderer.SetElement (Xamarin.Forms.VisualElement element)

Platform.CreateRenderer (Xamarin.Forms.VisualElement element, Android.Content.Context context)

VisualElementPackager.AddChild (Xamarin.Forms.VisualElement view, Xamarin.Forms.Platform.Android.IVisualElementRenderer oldRenderer, Xamarin.Forms.Platform.Android.RendererPool pool, System.Boolean sameChildren)

VisualElementPackager.SetElement (Xamarin.Forms.VisualElement oldElement, Xamarin.Forms.VisualElement newElement)

VisualElementPackager.Load ()

VisualElementRenderer`1[TElement].SetPackager (Xamarin.Forms.Platform.Android.VisualElementPackager packager)

VisualElementRenderer`1[TElement].SetElement (TElement element)

IVisualElementRenderer.SetElement (Xamarin.Forms.VisualElement element)

Platform.CreateRenderer (Xamarin.Forms.VisualElement element, Android.Content.Context context)

VisualElementPackager.AddChild (Xamarin.Forms.VisualElement view, Xamarin.Forms.Platform.Android.IVisualElementRenderer oldRenderer, Xamarin.Forms.Platform.Android.RendererPool pool, System.Boolean sameChildren)

VisualElementPackager.SetElement (Xamarin.Forms.VisualElement oldElement, Xamarin.Forms.VisualElement newElement)

VisualElementPackager.Load ()

VisualElementRenderer`1[TElement].SetPackager (Xamarin.Forms.Platform.Android.VisualElementPackager packager)

VisualElementRenderer`1[TElement].SetElement (TElement element)

IVisualElementRenderer.SetElement (Xamarin.Forms.VisualElement element)

Platform.CreateRenderer (Xamarin.Forms.VisualElement element, AndroidX.Fragment.App.FragmentManager fragmentManager, Android.Content.Context context)

FragmentContainer.OnCreateView (Android.Views.LayoutInflater inflater, Android.Views.ViewGroup container, Android.OS.Bundle savedInstanceState)

Fragment.n_OnCreateView_Landroid_view_LayoutInflater_Landroid_view_ViewGroup_Landroid_os_Bundle_ (System.IntPtr jnienv, System.IntPtr native__this, System.IntPtr native_inflater, System.IntPtr native_container, System.IntPtr native_savedInstanceState)

(wrapper dynamic-method) Android.Runtime.DynamicMethodNameCounter.94(intptr,intptr,intptr,intptr,intptr)


9 Replies

VD Vikram Devaraj Syncfusion Team August 5, 2021 01:46 PM UTC

Hi Nilo, 

Greetings from Syncfusion support, 
 
  
We were unable to reproduce your issue, App crashes when trying to reload a TabbedPage . Could you please try the below-provided sample and let us know whether we have missed out anything while replicating the issue.  
   
Please find the sample in the below link, which we have used to reproduce the issue in our end  
Kindly share the following details to analyze more on this issue and assist you with the better solution    
1.Simple sample/ modify the above sample to reproduce the issue.   
2.Replication video/procedure to reproduce the issue.  
3.PDF document 
4.Xamarin form version.
 
5.Device info 


Regards,
Vikram D

 



NB Nilo Basilio August 5, 2021 07:29 PM UTC

Hello Vikram,


We have modified the above sample, so now I hope it could be tested by your side, please. 

Also added some comments in the code to help knowing how our application are working. Also included a PDF for testing. We are using Xamarin.Forms 5.0.0.2012.

Basically, we are trying to reopen the Tabbed Page with the PDF's after navigating back to Home Page. That behavior is working with other pages from our application.


Thanks in advance!

Nilo



Attachment: TabbedPageWithNavigationPage_3c00306.zip


VD Vikram Devaraj Syncfusion Team August 6, 2021 08:52 AM UTC

Hi Nilo,

Thanks for the update. We were able to reproduce the issue, App crashes with exception when trying to reload a TabbedPage . Currently, we are validating this issue and we will update the further details on August 10, 2021. 
 
Regards, 
Vikram D 



VD Vikram Devaraj Syncfusion Team August 10, 2021 05:55 PM UTC

Hi Nilo,


Sorry for the inconvenience caused. We are still validating the issue, “App crashes with exception when trying to reload a TabbedPage
” due to the complexity of the issue. We will update the further details on August  12, 2021.


Regards,
Vikram D  



NB Nilo Basilio August 10, 2021 05:59 PM UTC

Hello Vikram,

No problem, I really appreciate your help.

Thanks, 
Nilo


VD Vikram Devaraj Syncfusion Team August 11, 2021 06:38 AM UTC

Hi Nilo,  
  
Thanks for your patience. As mentioned earlier we will provide the validation details for the issue, “App crashes with exception when trying to reload a TabbedPage” on August 12, 2021.  
  
Regards,  
Vikram D 



VD Vikram Devaraj Syncfusion Team August 12, 2021 03:33 PM UTC

Hi Nilo,   
 
Thank you for your patience, 
    
We have confirmed that the issue “App crashes with exception when trying to reload a TabbedPage” is a defect and logged a defect report for this issue. The patch for this issue will be delivered on  September 02, 2021.   
   
Please find the feedback link below,   
Regards,   
Vikram D 



NB Nilo Basilio August 12, 2021 06:02 PM UTC

Hello Vikram,


I am very glad for all the support. Thanks for the update. We will wait for this patch.


Thanks in advance!

Nilo



VD Vikram Devaraj Syncfusion Team September 2, 2021 05:06 PM UTC

Hi Nilo,

We have checked the reported issue and we would like to let you know that this is not an PdfViewer defect. While navigating from current  page to the previous page the garbage collector automatically dispose the memory stream, so the input stream will be disposed and closed in our source. Again, navigating to the pdfviewer page, no stream is provided and Cannot access a closed Stream exception occurs since the stream is closed. We can resolve this issue by creating new instance when you navigate to a page contains pdfviewer again or you can provide stream to the tabbed page from the main page.

Sample: https://www.syncfusion.com/downloads/support/directtrac/general/ze/Tab1938843354.zip

Reference stack overflow link: https://stackoverflow.com/questions/46912056/application-current-mainpage-vs-navigation-pushasync-vs-navigation-pushmodalas

Regards,
Vikram
 


Loader.
Up arrow icon