Xamarin forms Error displaying SideDraw on ios device, works in simulator

1 Answer 205 Views
SideDrawer - Xamarin.iOS
Steven
Top achievements
Rank 1
Iron
Steven asked on 24 Jun 2021, 02:12 PM

An error occurred: 'Object reference not set to an instance of an object.'. Callstack: '  at Telerik.XamarinForms.PrimitivesRenderer.iOS.SideDrawerRenderer.OnElementAttached (Telerik.XamarinForms.Primitives.RadSideDrawer newElement) <0x103c213b8 + 0x00054> in <3815ecfd73d84df698419fd5cca8ff43>:0 
  at Telerik.XamarinForms.Common.iOS.IosRendererBase`2[S,T].OnElementChanged (Xamarin.Forms.Platform.iOS.ElementChangedEventArgs`1[TElement] e) <0x112c3a4f0 + 0x00062> in <e4beb37b571e46a0993fb50802f2986c>:0 

 

I get this error on Iphone 5s & Ipad mini with the demo code for sidedraw

 

<ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
             xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
             xmlns:d="http://xamarin.com/schemas/2014/forms/design"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
             mc:Ignorable="d"
             xmlns:local="clr-namespace:TelerikXamarinApp1.Portable"
             xmlns:telerikPrimitives="clr-namespace:Telerik.XamarinForms.Primitives;assembly=Telerik.XamarinForms.Primitives"
             xmlns:telerikDataControls="clr-namespace:Telerik.XamarinForms.DataControls;assembly=Telerik.XamarinForms.DataControls"
             xmlns:telerikChart="clr-namespace:Telerik.XamarinForms.Chart;assembly=Telerik.XamarinForms.Chart"
             xmlns:telerikInput="clr-namespace:Telerik.XamarinForms.Input;assembly=Telerik.XamarinForms.Input"
             xmlns:telerikGauges="clr-namespace:Telerik.XamarinForms.DataVisualization.Gauges;assembly=Telerik.XamarinForms.DataVisualization"
             xmlns:telerikGrid="clr-namespace:Telerik.XamarinForms.DataGrid;assembly=Telerik.XamarinForms.DataGrid"
             xmlns:telerikBarcode="clr-namespace:Telerik.XamarinForms.Barcode;assembly=Telerik.XamarinForms.Barcode"
             xmlns:telerikConversationalUI="clr-namespace:Telerik.XamarinForms.ConversationalUI;assembly=Telerik.XamarinForms.ConversationalUI"
             xmlns:telerikImageEditor="clr-namespace:Telerik.XamarinForms.ImageEditor;assembly=Telerik.XamarinForms.ImageEditor"
             xmlns:telerikMap="clr-namespace:Telerik.XamarinForms.Map;assembly=Telerik.XamarinForms.Map"
             xmlns:telerikPdfViewer="clr-namespace:Telerik.XamarinForms.PdfViewer;assembly=Telerik.XamarinForms.PdfViewer"
             xmlns:telerikRichTextEditor="clr-namespace:Telerik.XamarinForms.RichTextEditor;assembly=Telerik.XamarinForms.RichTextEditor"
             x:Class="TelerikXamarinApp1.Portable.MainPage">

    <telerikPrimitives:RadSideDrawer x:Name="drawer" DrawerLength="200">
        <telerikPrimitives:RadSideDrawer.MainContent>
            <Label Text="Main content" />
        </telerikPrimitives:RadSideDrawer.MainContent>
        <telerikPrimitives:RadSideDrawer.DrawerContent>
            <Label Text="Drawer content" />
        </telerikPrimitives:RadSideDrawer.DrawerContent>
    </telerikPrimitives:RadSideDrawer>

</ContentPage>
Steven
Top achievements
Rank 1
Iron
commented on 24 Jun 2021, 02:19 PM

Forgot to add this is using VS on windows (VS,XCode,Telerik all latest versions)
Yana
Telerik team
commented on 28 Jun 2021, 01:33 PM

I am not able to reproduce this error, so I would need more details on the concrete setup you have.  How do you reference the Telerik assemblies?  Do you add the needed references inside the iOS project as well - if it's the Telerik.UI.for.Xamarin nuget, it should be installed in the iOS project, if you manually add assemblies, you should add the ones from the iOS folder.  Do you use the latest release of Telerik UI for Xamarin? Any additional information you could provide would be of help.

1 Answer, 1 is accepted

Sort by
0
Accepted
Steven
Top achievements
Rank 1
Iron
answered on 28 Jun 2021, 01:39 PM

I raised this question as a ticket and got this reply. Apparently some of the Telerik controls don't work if you use hot restart.

 

Are you using VS 2019 PC Hot Restart? If yes, the crash is expected behavior because Hot Restart is not currently support with static iOS libraries. This is an unfortunate limitation of Microsoft's Hot Restart feature that we have no control over.

UI for Xamarin uses static libraries for native iOS controls like the SideDrawer. The reason the RadBorder works is because it is a pure Xamarin.Forms-based control (we use SkiaSharp for rendering). 

> If you want to see what is a control that comes form the static native libraries, you can review the native UI for Xamarin.iOS wrappers documentation.

Solution

To work around this limitation, plug the iPhone into the Mac and rebuild the project then deploy/debug through the Mac.

Tags
SideDrawer - Xamarin.iOS
Asked by
Steven
Top achievements
Rank 1
Iron
Answers by
Steven
Top achievements
Rank 1
Iron
Share this question
or