Control constantly crashes from a COMException

Hello, I've been trying to get the SfPdfViewer control working on Xamarin.Froms (UWP) but it seems very crash prone.

I created a new blank page with only the control inside for testing and noticed that it only doesn't crash if I put a breakpoint after the InitializeComponent call and wait for a couple of seconds. Both the XAML and code-behind are also included in the zip.

For the PDF I'm using (attached in the zip) I'm only reading it to a byte array, creating a MemoryStream instance and then loading it using LoadDocumentAsync(Stream, CancelationTokenSource) as described in the documentation


Here's the exception message:

System.Runtime.InteropServices.COMException: Error HRESULT E_FAIL has been returned from a call to a COM component.

   at Windows.UI.Xaml.UIElement.Measure(Size availableSize)

   at Xamarin.Forms.Platform.UWP.VisualElementRenderer`2.MeasureOverride(Size availableSize)

   at Windows.UI.Xaml.UIElement.Measure(Size availableSize)

   at Xamarin.Forms.Platform.UWP.VisualElementRenderer`2.MeasureOverride(Size availableSize)

   at Windows.UI.Xaml.UIElement.Measure(Size availableSize)

   at Xamarin.Forms.Plat


I'm using the nugget version 19.2.0.60

Thank you in advance.





Attachment: pdf_2c1dcedf.zip

1 Reply

VD Vikram Devaraj Syncfusion Team September 17, 2021 05:47 AM UTC

Hi Sebastien

We were unable to reproduce the issue, Loading the document async will crash with
COMException and it is working as expected. 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 
https://www.syncfusion.com/downloads/support/directtrac/general/ze/Sample1677415136.zip
 
 
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. 
3.Xamarin version.

Regards,
Vikram
 


Loader.
Up arrow icon