Declined
Last Updated: 19 Nov 2020 13:20 by Chris
Chris
Created on: 16 Nov 2020 21:12
Category: PdfViewer
Type: Bug Report
0
MissingFieldException while initializing controls in XAML page using RadPdfViewer on Xamarin iOS

System.MissingFieldException: Field not found: Telerik.XamarinForms.SkiaSharp.SkiaDocumentView.purePainter Due to: Could not parse field signature 0a00031b due to: Could not resolve type with token 0100014e from typeref (expected class 'Telerik.XamarinForms.SkiaSharp.DocumentView.SkiaDocumentPurePainter' in assembly 'Telerik.XamarinForms.SkiaSharp, Version=2020.3.1106.460, Culture=neutral, PublicKeyToken=null') assembly:Telerik.XamarinForms.SkiaSharp, Version=2020.3.1106.460, Culture=neutral, PublicKeyToken=null type:Telerik.XamarinForms.SkiaSharp.DocumentView.SkiaDocumentPurePainter member:(null)
  at Telerik.XamarinForms.PdfViewer.RadPdfViewer.UpdatePresenter () [0x00037] in <bd15b7ab3df742a5908d5d151a9a58d8>:0
  at Telerik.XamarinForms.PdfViewer.RadPdfViewer..ctor () [0x00048] in <bd15b7ab3df742a5908d5d151a9a58d8>:0
  at OnaMobile.Views.PdfViewPage.InitializeComponent () [0x00012] in C:\Users\chris\Work\ONAMA\onama-mobile-app\OnaMobile\OnaMobile\obj\Debugetstandard2.0\Views\PdfViewPage.xaml.g.cs:22
  at OnaMobile.Views.PdfViewPage..ctor () [0x00008] in C:\Users\chris\Work\ONAMA\onama-mobile-app\OnaMobile\OnaMobile\Views\PdfViewPage.xaml.cs:19
  at OnaMobile.ViewModels.ResourcesPageViewModel.OpenResourceAsync (OnaMobile.OnlineResources.ResourceLink resource) [0x001ac] in C:\Users\chris\Work\ONAMA\onama-mobile-app\OnaMobile\OnaMobile\ViewModels\ResourcesPageViewModel.cs:186

iOS SDK 14.1, ARM64. Happens regardless of Linker Behavior setting.

The page itself has nothing in its code-behind other than the default constructor calling InitializeComponent(). In the XAML, the RadPdfViewer control is in a two-row, one-column grid, where it is in the second row:

<Grid VerticalOptions="FillAndExpand" HorizontalOptions="FillAndExpand" ColumnSpacing="0" RowSpacing="0">
    <Grid.RowDefinitions>
        <RowDefinition Height="60" />
        <RowDefinition Height="*" />
    </Grid.RowDefinitions>

    <Frame Grid.Row="0"><!-- ... --></Frame>

    <pdf:RadPdfViewer Grid.Row="1" HorizontalOptions="Fill" VerticalOptions="FillAndExpand" Source="{Binding Source}" />
</Grid>
The view model has a DocumentSource property Source and implements INotifyPropertyChanged. However the exception occurs before the BindingContext of the page is set to the view model.
4 comments
Chris
Posted on: 19 Nov 2020 13:20
This worked, thanks.
ADMIN
Yana
Posted on: 18 Nov 2020 12:42

Hello Chris,

Thank you for the follow-up. There is a version mismatch which is causing the error.  I understand that you'd prefer using the nuget package, and until we resolve the issue with the WindowsBase assembly, I would suggest you reference separate nuget packages instead of the complete Telerik.UI.for.Xamarin package. In this way, you can easily skip adding the Telerik.UI.for.Xamarin.Documents.Flow assembly. 

The required nuget packages for RadPdfViewer are listed below:

  • Telerik.UI.for.Xamarin.PdfViewer
  • Telerik.UI.for.Xamarin.Common,
  • Telerik.UI.for.Xamarin.Primitives,
  • Telerik.UI.for.Xamarin.SkiaSharp,

Please make sure to update the nuget packages in all projects (Xamarin.Forms, iOS, Android) inside the solution.

I am so sorry for the caused inconvenience with this.  I hope this workaround would be useful.

Let me know if you have any additional issues or concerns with this.

Regards,
Yana
Progress Telerik

Virtual Classroom, the free self-paced technical training that gets you up to speed with Telerik and Kendo UI products quickly just got a fresh new look + new and improved content including a brand new Blazor course! Check it out at https://learn.telerik.com/.

Chris
Posted on: 17 Nov 2020 16:21

We are using NuGet for package management. We had Telerik.UI.for.Xamarin.Lite 2020.1.114.1 in use originally and updated to 2020.3.1106.1; because of this other Telerik UI for Xamarin issue, we have a custom Telerik.UI.for.Xamarin.Documents.Flow 2020.3.1019 package that removes the WindowsBase and PresentationCore framework dependencies. For Telerik.UI.for.Xamarin.PdfViewer, we are using 2020.3.1106.1 and started at this version; it pulls in Telerik.UI.for.Xamarin.SkiaSharp 2020.3.1106.1 directly as one of its own dependencies, along with SkiaSharp and SkiaSharp.Views.Forms 1.68.0.

Deleting the bin and obj directories and rebuilding was one of the first things I tried before creating this issue, without any success. After rebuild, I can confirm that Telerik.XamarinForms.PdfViewer.dll v2020.3.1106.460 and Telerik.XamarinForms.SkiaSharp.dll v2020.3.1106.460 are present in the app package, but the problem continues. I've also confirmed that these version numbers match the versions of the assemblies in the NuGet packages.

ADMIN
Yana
Posted on: 17 Nov 2020 15:06

Hello Chris,

Thank you for posting the exception.

I would need a little bit more information on how you've come across the error - does it happen after an upgrade of our Xamarin controls? Can you check whether you have referenced all the assemblies (nuget packages) needed for RadPdfViewer and whether they're of the same version?  The exception indicates an issue with our Telerik.XamarinForms.SkiaSharp assembly, so please make sure it's refenced from the same location and is of the same version as the other Telerik Xamarin assemblies.

Other than that, the error can be related to a cache issue in Visual Studio, so please delete bin and obj folders, clean and rebuild the solution.

If this does not help, I would ask you to open a support ticket and send us a small repro project, so we can investigate on our side and hopefully find out what's the reason behind the exception.

I look forward to your reply.

Regards,
Yana
Progress Telerik

Virtual Classroom, the free self-paced technical training that gets you up to speed with Telerik and Kendo UI products quickly just got a fresh new look + new and improved content including a brand new Blazor course! Check it out at https://learn.telerik.com/.