Error when building Xamarin project on iOS

1 Answer 394 Views
BusyIndicator General Discussions
Anish
Top achievements
Rank 1
Anish asked on 08 Sep 2021, 09:11 PM

Hi, I'm getting the following error when building my Xamarin.Forms project on iOS. Weirdly enough it was working fine the other day and now it consistently gives me this error. The application itself launches on iOS but half the pages are missing and some pages are missing components. 

The type initializer for 'Telerik.XamarinForms.SkiaSharp.SkiaPainter' threw an exception.  
  Exception of type 'System.Exception' was thrown.
  Telerik.XamarinForms.Common
  at Telerik.XamarinForms.Common.NativeResourceProvider.ToPlatformPixels (System.Double dip) [0x00000] in <c043edb38e3c40609bb9cbd0df9066be>:0 
  at Telerik.XamarinForms.SkiaSharp.SkiaPainter.UpdateExpectedPpxToDpRatio () [0x00000] in <5c673afa45f14dd59e1a272b3f01ee1a>:0 
  at Telerik.XamarinForms.SkiaSharp.SkiaPainter..cctor () [0x00017] in <5c673afa45f14dd59e1a272b3f01ee1a>:0 


    at (wrapper managed-to-native) System.Object.__icall_wrapper_mono_generic_class_init(intptr)
  at Telerik.XamarinForms.Primitives.RadPath..ctor () [0x0001b] in <38c0677356f14f22a10877afa8da8671>:0 
  at Telerik.XamarinForms.Primitives.Animation1.CreatePath (System.Int32 figuresCount, System.Double thickness) [0x0005d] in <38c0677356f14f22a10877afa8da8671>:0 
  at Telerik.XamarinForms.Primitives.Animation1..ctor (Xamarin.Forms.Color color) [0x00049] in <38c0677356f14f22a10877afa8da8671>:0 
  at Telerik.XamarinForms.Primitives.AnimationFactory+<>c.<.cctor>b__1_0 (Xamarin.Forms.Color p) [0x00000] in <38c0677356f14f22a10877afa8da8671>:0 
  at Telerik.XamarinForms.Primitives.AnimationFactory.CreateAnimation (Telerik.XamarinForms.Primitives.AnimationType animationType, Xamarin.Forms.Color color) [0x00019] in <38c0677356f14f22a10877afa8da8671>:0 
  at Telerik.XamarinForms.Primitives.RadBusyIndicator.PrepareAnimations () [0x00029] in <38c0677356f14f22a10877afa8da8671>:0 
  at Telerik.XamarinForms.Primitives.RadBusyIndicator..ctor () [0x0002d] in <38c0677356f14f22a10877afa8da8671>:0

    

1 Answer, 1 is accepted

Sort by
1
Lance | Manager Technical Support
Telerik team
answered on 08 Sep 2021, 09:27 PM

Hi Anish,

This looks like the project might be missing SkiaSharp.

SkiaSharp Dependencies

Make sure you have the SkiaSharp dependencies installed to all the projects. If you are not sure what those are, please visit this section in the documentation=> https://docs.telerik.com/devtools/xamarin/installation-and-deployment/skia-vs-noskia#skiasharp-nuget-packages

For your convenience, here's the list:

  • SkiaSharp (install to all projects)
  • SkiaSharp.Views (install to all projects, except class library)
  • SkiaSharp.Views.Forms (install to all projects)

 

Linker Considerations

Also, make sure you do not have the linker enabled. This will strip out necessary code that the runtime static libraries require. For more information on how to set your linker settings, visit my KB article on the topic => How to Avoid Exception From Setting Linker Behavior to Link All.

 

Manual Clean

If this is a sudden change, I also recommend deleting the bin and obj folders from every project. Next, open the project in Visual Studio, make sure every project has explicitly installed the necessary SkiaSharp packages for that platform (instead of relying on transient dependencies) and then do a full Rebuild. This will pull in a fresh copy of any NuGet packages and your compiled assemblies should contain the latest.

Other Articles

Finally, here is another article worth quickly reading, but I'm not sure if it relevant for your project iOS app has issues on device but runs fine on simulator.

Regards,
Lance | Manager Technical Support
Progress Telerik

Love the Telerik and Kendo UI products and believe more people should try them? Invite a fellow developer to become a Progress customer and each of you can get a $50 Amazon gift voucher.

Anish
Top achievements
Rank 1
commented on 08 Sep 2021, 09:38 PM

Hi, 

I have already checked to make sure SkiSharp, SkiaSharp.Views and SkiaSharp.Views.Forms are installed on all projects, also tried setting the Linker from Sdk Assemblies Only to None both did not fix the issue. I just deleted all the bin and obj folders, will rebuild and try again. 

Any other suggestions in case this does not work?


Thank you,

Anish
Top achievements
Rank 1
commented on 08 Sep 2021, 09:59 PM

Deleting the obj and bin folders and rebuilding did not work ...
Lance | Manager Technical Support
Telerik team
commented on 08 Sep 2021, 10:37 PM

I'm afraid that I cannot guess as to what the issue is. Your statement of "the other day it was working" doesn't tell me a lot about what might have changed since then.

Did you change code? Did you switch Telerik assemblies to the Lite version? Does the project build fine, but you're only seeing this issue at runtime (is it debug or release compiled?). Did you uninstall the app from the device before redeploying the latest Rebuild?

In order for us to investigate further, please open a Technical Support ticket and attach the project (be sure to delete the bin and objs before zipping it up). The engineers can take a direct look at the project configuration and offer suggestions.

Note:  When opening the case, be sure to select Telerik UI for Xamarin - BusyIndicator (instead of Xamarin.iOS - Busy Indicator).

Anish
Top achievements
Rank 1
commented on 08 Sep 2021, 11:15 PM

That won't be necessary, I got it working.
Didi
Telerik team
commented on 09 Sep 2021, 08:53 AM

I am glad to hear the project works as expected. Would it be possible to share the exact steps you follow to resolve the exception on your side?
Tags
BusyIndicator General Discussions
Asked by
Anish
Top achievements
Rank 1
Answers by
Lance | Manager Technical Support
Telerik team
Share this question
or