App crashes when returning from a pdf viewer page (Android)

Hi,

I am experiencing problems when I press the return button from a navigation page where I use SfPdfViewer on Android.

When I load the page I retrieve a fairly big pdf from an url (~12Mb) which I then convert to a stream and load into the pdf viewer.
It all works fine, but after the document being loaded, I wait around ~10-15 seconds  without scrolling or doing anything, press the back button to go back to the previous page, then the app crashes.

Here is a sample of my code of when I open and close the page:

protected async override void OnAppearing()
{
base.OnAppearing();

string pdfUrl = "https://azure.microsoft.com/mediahandler/files/resourcefiles/learn-azure-in-a-month-of-lunches/Learn_Azure_in_a_Month_of_Lunches.pdf";

using (WebClient wc = new WebClient())
{
byte[] dataArray = await wc.DownloadDataTaskAsync(pdfUrl);

_fileStream = new MemoryStream(dataArray);
}

//Load the PDF
pdfViewerControl?.LoadDocument(_fileStream);            
}

protected override void OnDisappearing()
{
base.OnDisappearing();

pdfViewerControl?.Unload();
_fileStream?.Close();
_fileStream?.Dispose();
}

For some reasons I get all different kind of messages:
  • System.ArgumentNullException: 'Value cannot be null. Parameter name: document'
  • System.NullReferenceException: 'Object reference not set to an instance of an object.'
  • System.DivideByZeroException: 'Attempted to divide by zero.'
I really can't figure out where the problem is coming from.

I am attaching a sample project that illustrates the problem.

Thank you for any help you can provide.

PS: I am on Windows 10, using VS Studio 2019 and the latest versions of Xamarin of all related Syncfusion packages.

Attachment: SyncfusionPDFViewer_4f2c3252.7z

8 Replies

FM Fred Meyer March 14, 2020 12:59 PM UTC

I also tried to put the file in the project and to load it locally.

The same problem occurs :(


JP Jhansi Priya Ramesh Syncfusion Team March 16, 2020 10:49 AM UTC

Hi Fred, 

Greetings from Syncfusion support. 

We were able to reproduce the issue “Application crashes while unloading the PDF document in Android” in our side and we suspect this to be a defect. We are currently validating the issue and we will provide further details on 18th March 2020 

Regards, 
Jhansi Priya Ramesh 



FM Fred Meyer March 16, 2020 06:43 PM UTC

Ah cool, thx


JP Jhansi Priya Ramesh Syncfusion Team March 17, 2020 06:26 AM UTC

Hi Fred, 

Thank you for the update. As promised earlier, we will provide validation details for the issue “Application crashes while unloading the PDF document in Android” on 18th March 2020.  

Regards, 
Jhansi Priya Ramesh 



JP Jhansi Priya Ramesh Syncfusion Team March 18, 2020 10:34 AM UTC

Hi Fred, 

We confirm that the issue “Application crashes while unloading the PDF document in Android” is a defect in our side and we will provide patch for this issue on 8th April 2020. 

Regards, 
Jhansi Priya Ramesh 



AV Ashokkumar Viswanathan Syncfusion Team April 8, 2020 05:27 PM UTC

Hi Fred, 
 
The issue , “Application crashes while unloading the PDF document in Android” has been resolved and the fix is published in our weekly NuGet release with version 18.1.0.43. Kindly update your SfPdfViewerControl the mentioned version to get the issue resolved.   
 
Regards, 
Ashok Kumar Viswanathan. 



TA Tao March 28, 2024 01:50 PM UTC

Hi,


We still have this issue on iOS. It works fine on Android. We are using an up to date version.


Thank y



MA ManojKumar Arumugasamy Syncfusion Team April 1, 2024 06:36 AM UTC

Hi  Tao, 

 

We were unable to reproduce the issue, Application crashes while unloading the PDF document in iOS and it is working as expected. We have tried to load and unload different types of documents. Could you please try the sample and let us know whether we have missed anything while replicating the issue? 

  

Please find the sample in the below link, which we have used to reproduce the issue on our end 

https://www.syncfusion.com/downloads/support/directtrac/general/ze/152426Sample1948964081 

 

Please share the following details to analyze this issue further and assist you with a better solution. 

1. Simple sample/ modify the above sample to reproduce the issue.  

2. Replication video/procedure to reproduce the issue. 

3.PDF document that might cause the issue

 

Regards, 
Manoj Kumar


Loader.
Up arrow icon