Telerik Reporting Conflicts with SkiaSharp v4
Environment
| Product | Reporting |
| Version | 20.2.26.1007 |
Description
I have updated the SkiaSharp package in my project to v4.153.1. When I use the Skia graphics engine for previewing the report, I encounter a System.MethodAccessException when rendering reports in Telerik Reporting after upgrading to version 20.2.26.1007.
Error Message
System.MethodAccessException: Attempt by method 'SkiaSharp.HarfBuzz.SKShaper.Shape(System.String, SkiaSharp.SKPaint)' to access method 'SkiaSharp.SKPaint.GetFont()' failed.
Cause
The issue arises due to version mismatches between the SkiaSharp and SkiaSharp.HarfBuzz NuGet packages. When updating one, the other package should also be updated to the same version to ensure compatibility.
Solution
To resolve the issue, synchronize the versions of the SkiaSharp and SkiaSharp.HarfBuzz packages. Follow these steps:
-
Update the
SkiaSharp.HarfBuzzNuGet package to match the version of theSkiaSharppackage. For example, if usingSkiaSharp v4.153.1, updateSkiaSharp.HarfBuzztov4.153.1as well. -
If your application runs on Linux, update the "NativeAssets" dependencies for consistency. Update the following packages:
xml<PackageReference Include="SkiaSharp" Version="4.153.1" /> <PackageReference Include="SkiaSharp.HarfBuzz" Version="4.153.1" /> <PackageReference Include="SkiaSharp.NativeAssets.Linux" Version="4.153.1" /> <PackageReference Include="SkiaSharp.NativeAssets.Win32" Version="4.153.1" /> -
After updating the packages, rebuild your application to apply the changes.