Getting a NullReferenceException from a SfBackdropPage in iOS

Hi,

I'm getting a NullReferenceException from a SfBackdropPage in iOS. I have been able to reproduce this problem in a small project.

After I created an Xamarin.Forms project, I created a simple SfBackdropPage page, with BackLayerRevealOption set to "Auto". However, when I run this project, it crashes directly. 

When I placed a try/catch on the InitializeComponent(), I found the following exception was thrown (full exception below:

System.NullReferenceException: Object reference not set to an instance of an object
  at Syncfusion.XForms.Backdrop.SfBackdropPage.OnBackLayerRevealOptionPropertyChanged (System.Object oldValue, System.Object newValue) [0x00038] in <b3a1a18f01b04b08a913787c6131bdb9>:0 

This exception occurs when I run it on an iOS emulator on a mac.

This exception does not occur in Android. In addition, when I run the application via Hot Restart on a physical iOS device, it also works fine

What can I do to fix this issue?

I have added the project in the attachments. Thanks in advance!

Full exception:
{System.NullReferenceException: Object reference not set to an instance of an object
  at Syncfusion.XForms.Backdrop.SfBackdropPage.OnBackLayerRevealOptionPropertyChanged (System.Object oldValue, System.Object newValue) [0x00038] in <b3a1a18f01b04b08a913787c6131bdb9>:0 
at Syncfusion.XForms.Backdrop.SfBackdropPage.OnBackLayerRevealOptionPropertyChanged (Xamarin.Forms.BindableObject bindable, System.Object oldValue, System.Object newValue) [0x00000] in <b3a1a18f01b04b08a913787c6131bdb9>:0 
  at Xamarin.Forms.BindableObject.SetValueActual (Xamarin.Forms.BindableProperty property, Xamarin.Forms.BindableObject+BindablePropertyContext context, System.Object value, System.Boolean currentlyApplying, Xamarin.Forms.Internals.SetValueFlags attributes, System.Boolean silent) [0x00120] in D:\a\1\s\Xamarin.Forms.Core\BindableObject.cs:463 
  at Xamarin.Forms.BindableObject.SetValueCore (Xamarin.Forms.BindableProperty property, System.Object value, Xamarin.Forms.Internals.SetValueFlags attributes, Xamarin.Forms.BindableObject+SetValuePrivateFlags privateAttributes) [0x00173] in D:\a\1\s\Xamarin.Forms.Core\BindableObject.cs:397 
  at Xamarin.Forms.BindableObject.SetValue (Xamarin.Forms.BindableProperty property, System.Object value, System.Boolean fromStyle, System.Boolean checkAccess) [0x00042] in D:\a\1\s\Xamarin.Forms.Core\BindableObject.cs:334 
  at Xamarin.Forms.BindableObject.SetValue (Xamarin.Forms.BindableProperty property, System.Object value) [0x00000] in D:\a\1\s\Xamarin.Forms.Core\BindableObject.cs:311 
  at iOSBackdrop.MainPage.InitializeComponent () [0x00012] in C:\Users\rcat\source\repos\iOSBackdrop\iOSBackdrop\obj\Debug\netstandard2.0\MainPage.xaml.g.cs:22 
  at iOSBackdrop.MainPage..ctor () [0x00009] in C:\Users\rcat\source\repos\iOSBackdrop\iOSBackdrop\MainPage.xaml.cs:18 }

Attachment: iOSBackdrop_11094f81.zip

3 Replies 1 reply marked as answer

ET Eswaran Thirugnanasambandam Syncfusion Team February 24, 2021 02:27 PM UTC

Hi Richard, 
 
Greetings from Syncfusion, 
 
We checked the reported issue “Getting Null reference Exception from a SfBackdropPage in iOS” with the provided sample and we found that the initialization of SfBackdropPage is not added in the AppDelagate class in the iOS project.  
 
The reported issue can be resolved by adding the below code in the AppDelegate class. 
 
Code Snippet: 
public override bool FinishedLaunching(UIApplication app, NSDictionary options) 
        { 
            global::Xamarin.Forms.Forms.Init(); 
            SfBackdropPageRenderer.Init(); 
            LoadApplication(new App());  
            return base.FinishedLaunching(app, options); 
        } 
 
For more details about loading SfBackdropPage in iOS is provided below. 
 
 
Regards, 
Eswaran  


Marked as answer

RI Richard February 25, 2021 08:34 AM UTC

This solved my issue, thank you!


SS Sridevi Sivakumar Syncfusion Team February 25, 2021 10:35 AM UTC

Hi Richard,

Thanks for your update. We are glad to hear that given suggestion works at your end.

Please let us know if you need any further assistance.

Regards,
Sridevi S. 
  


Loader.
Up arrow icon