Completed
Last Updated: 15 May 2019 13:53 by ADMIN
Release R2 2019
Edward
Created on: 04 Apr 2019 21:41
Category: PdfViewer
Type: Bug Report
0
PDF Viewer on RadTabView Crash Between Tab Selections

I am Lazy Loading a document in a TabViewItem on the RadTabView Control. Here are the steps.

 

1. My Page opens and I am on my Main Tab.

2. The user has two Bottom Menu Options, one of them is for a view of a Document.

3. The user selects the Document Tab Option, and the I fire an Async operation that Loads a Byte Array that the PDFViewer is bound to. This loads fine. The document successfully loads in the viewer.

4. The user goes back to the Main Tab

5. The user then selects the Document Tab Option again, the Byte Array is already loaded so I do not Load it again in my ViewModel. So, I am not updating the Source Property on the PDFViewer again once it is loaded. I also tried just reloading the document with the same results.

The application just crashes. My guess is the Rendering or Re-Rendering of the Pdf Document between Tab Selections and there is someting 

 

If the document is never loaded, the app does not crash. However, once I load the document in the PDFViewer that exists on a Tab, the Application will crash if the user moves between tabs.

   Stack Trace from the Native Crash Reporting from the Application Output Window.

at <unknown> <0xffffffff>
at SkiaSharp.SkiaApi:sk_canvas_draw_path <0x000fe>
at SkiaSharp.SKCanvas:DrawPath <0x001f2>
at Telerik.XamarinForms.SkiaSharp.PdfSkiaPathPainter:Paint <0x00b42>
at Telerik.XamarinForms.SkiaSharp.SkiaPainterBase:Paint <0x0010f>
at Telerik.XamarinForms.Common.Painters.Painter:TryPaint <0x00176>
at Telerik.XamarinForms.Common.Painters.Painter:Paint <0x003a2>
at Telerik.XamarinForms.SkiaSharp.SkiaPainter:Canvas_PaintSurface <0x0038c>
at SkiaSharp.Views.Forms.SKCanvasView:OnPaintSurface <0x000bc>
at SkiaSharp.Views.Forms.SKCanvasView:SkiaSharp.Views.Forms.ISKCanvasViewController.OnPaintSurface <0x00076>
at SkiaSharp.Views.Forms.SKCanvasViewRendererBase`2:OnPaintSurface <0x001d5>
at SkiaSharp.Views.iOS.SKCanvasView:DrawInSurface <0x0015c>
at SkiaSharp.Views.iOS.SKCanvasView:Draw <0x005b3>
at <Module>:runtime_invoke_void__this___CGRect <0x003f9>
at <unknown> <0xffffffff>
at UIKit.UIApplication:UIApplicationMain <0x00211>
at UIKit.UIApplication:Main <0x000b2>
at UIKit.UIApplication:Main <0x00222>
at EMMA.FINSM.iOS.Application:Main <0x00092>
at <Module>:runtime_invoke_void_object <0x00178>

 

 

Example of my Binding. Very simple Byte Array Binding, and out of the box example from the QSF Code. I also tried using a Stream and it does the same thing.

<Grid>
     <Grid.RowDefinitions>
         <RowDefinition Height="Auto"/>
         <RowDefinition/>
     </Grid.RowDefinitions>
     <telerikPdfViewer:RadPdfViewerToolbar PdfViewer="{Binding Source={x:Reference PDFView}}">
         <telerikPdfViewer:NavigateToPreviousPageToolbarItem/>
         <telerikPdfViewer:NavigateToNextPageToolbarItem/>
         <telerikPdfViewer:NavigateToPageToolbarItem/>
         <telerikPdfViewer:FitToWidthToolbarItem/>
         <telerikPdfViewer:ToggleLayoutModeToolbarItem/>
     </telerikPdfViewer:RadPdfViewerToolbar>
          
     <telerikPdfViewer:RadPdfViewer x:Name="PDFView" Grid.Row="1" Source="{Binding Document}" />
 </Grid>
public byte[] Document
{
    get => _document;
 
    set
    {
        SetProperty(ref _document, value);
    }
}

 

2 comments
ADMIN
Didi
Posted on: 08 Apr 2019 13:43
Hi Edward,

Thank you for the provided code and detailed explanation.

I have tested the described scenario and I reproduced the exception on my side. It seems that the PdfViewer is trying to access data which is disposed. I have converted this forum thread into a public bug report, so you could easily track its status. Please find your Telerik points updated. 

Workaround:

You could use the solution you have found (Tabbed Page) or using the RadTabView and set the PdfViewer's Source to null every time when switching between the Tabs and set the source again when you are on the concrete tab.

Additionally, I would like to address the concern you have about the response in the Telerik UI for Xamarin Forum. - In general we try to address all the queries there, however there is no guarantee response time and if you have an urgent question I would recommend to post it in the support ticketing system where you will have 24 hours guarantee response time as you have a priority support included. 

Regards,
Didi
Progress Telerik
Edward
Posted on: 06 Apr 2019 12:46

My final solution was just to move the PDFViewer off of a RadTabView Content View, and display in a Content Page through navigation from my Tabbed Content Page. This is the only way I got it to work. Now, I can move back and forth between Content Pages and the PDFViewer never generates the Error. 

 

Good to see that the Administrators of this Forum are looking and posting replies to a newer product in the stack. Hence...there have been no Admin replies to my question.