This is a migrated thread and some comments may be shown as answers.

You MUST call Xamarin.Forms.Init() prior to using it

1 Answer 863 Views
This is a migrated thread and some comments may be shown as answers.
Top achievements
Rank 1
Mahesh asked on 02 Feb 2021, 08:28 AM

I'm using RadPdfViewer control to show pdf document in our Xamarin form app. The app is working fine on Android(device and Simulator) and also on iOS simulator.
But App is crashing on iPhone device while launching the app. I'm getting the below error


Failed to force load assembly Telerik.XamarinForms.DataGrid.dll. Type:Telerik.XamarinForms.DataGrid.DataGridLocalizationManager.

Exception: 'You MUST call Xamarin.Forms.Init(); prior to using it.'. Callstack: '  at Xamarin.Forms.Device.get_PlatformServices () [0x00007] in D:\a\1\s\Xamarin.Forms.Core\Device.cs:87 
  at Xamarin.Forms.Device.get_RuntimePlatform () [0x00000] in D:\a\1\s\Xamarin.Forms.Core\Device.cs:57 
  at Telerik.XamarinForms.Common.RadDevice..cctor () <0x10c1fc1c8 + 0x00002> in <81c15264f2164ef79a02e84ed79e8bfd>:0

If I comment out the <telerikPdfViewer:RadPdfViewer x:Name="pdfViewer" /> control in the .xaml file the app loads properly

I have tried the solution provided on TelerikForm.Init() but it's not worked for me.

1 Answer, 1 is accepted

Sort by
Lance | Manager Technical Support
Telerik team
answered on 02 Feb 2021, 05:17 PM

Hi Mahesh,

Thank you for providing the details. That is a bit of a strange error, the DataGridLocalizationManager class was removed from Telerik UI for Xamarin more than a year ago.  This hints to me that the iOS project's bin/debug/iphone cache is out of date and is compiling/pushing with the old version.

My recommendation is to make sure you have thoroughly cleaned the iOS project before recompiling with the latest release. Let me take you through everything, just to make sure you have a clean start.

Fresh Start

Let's get you back to a clean start so that you can compile, with high confidence that the project is in the correct state. Please take the following steps

Phase 1 - Confirmation Steps

With the project still open in VS2019:

Phase 2- Repair Steps

  1. Close VS 2019
  2. Open the solution in File Explorer
  3. Permanently delete the iOS project's bin and obj folder
  4. Permanently delete the class library project's bin and obj folder
  5. Open the solution in VS2019 again
  6. Right-click on the iOS project, select "Set as Startup Project"
  7. Confirm/adjust the configuration to Debug/iPhone
  8. Right-click on the iOS project and choose Rebuild
  9. Delete the app off of the device
  10. Redeploy to iPhone

Demo Project

If that still doesn't help, I have prepared and attached a demo project that you can use for reference. I've included all the project heads, incase it is helpful in the future, but for now that iOS project is set as startup

> My project uses assembly references to the installation location, it will compile without any changes as long as you have Telerik UI for Xamarin 2021.1 installed.

Future 'New Project' Help

In the future, if you ever get stuck like this again, I recommend using our project template to make sure you have all the required pieces. We update the template so that it is always compatible with the current release.

Take these steps:

  1. Open VS2019
  2. File > New Project > select Telerik Xamarin UI project template
  3. Complete the Project Wizard's steps

You will get a brand new project with all the dependencies already configured for you. Just open MainPage.xaml and start coding.

Professional Support

I'm a little curious as to how you are using a new version of Telerik UI for Xamarin. Your current account has never had a Telerik license, for any product. Are you a developer using your company's purchased license? Although unintentional, this is a violation of the license policy.

Don't worry, this is a rather common scenario and you can fix it very quickly. Please contact your Telerik account manager and share my attachment (they can assign the license to you in literally  less than 1 minute).

After you are assigned to the license, you will be able to access your account's support (i.e. 24hr Priority Support) and all license resources (i.e. NuGet server, downloads, etc).

Lance | Manager Technical Support
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

Asked by
Top achievements
Rank 1
Answers by
Lance | Manager Technical Support
Telerik team
Share this question