NullReferenceException when creating ExcelEngine instance on iOS

Hello,
The following code runs well on Android and UWP, but crashes on iOS.

    private void m_cmdLoadExcelFile_Clicked(object sender, EventArgs e)
    {
      var l_aAssembly = typeof(MainPage).GetTypeInfo().Assembly;

      string l_strResourcePath = string.Format(l_aAssembly.GetName().Name + ".Species.xlsx");

      using (Stream l_sStream = l_aAssembly.GetManifestResourceStream(l_strResourcePath))
      {
        ExcelEngine l_eeExcel = new ExcelEngine();

        IApplication l_iaApplication = l_eeExcel.Excel;

        l_iaApplication.DefaultVersion = ExcelVersion.Excel2016;

        var l_wbExcelDefinitions = l_eeExcel.Excel.Workbooks.Open(l_sStream);
      }
    }

Here is the detail of the exception :
System.NullReferenceException: Object reference not set to an instance of an object
  at Syncfusion.XlsIO.ExcelEngine..ctor () <0x13a04fc + 0x0002c> in <eb6889c68fc841c380c8f7beaa9bef15#beb0cf58313962fb1de46ee333a1d2ae>:0
  at (wrapper managed-to-native) UIKit.UIApplication:UIApplicationMain (int,string[],intptr,intptr)
  at UIKit.UIApplication.Main (System.String[] args, System.IntPtr principal, System.IntPtr delegate) [0x00005] in /Users/builder/data/lanes/5520/51128b8c/source/xamarin-macios/src/UIKit/UIApplication.cs:79
  at UIKit.UIApplication.Main (System.String[] args, System.String principalClassName, System.String delegateClassName) [0x00038] in /Users/builder/data/lanes/5520/51128b8c/source/xamarin-macios/src/UIKit/UIApplication.cs:63
  at TestPolux.iOS.Application.Main (System.String[] args) [0x00002] in C:\Users\Gasser\Desktop\CBS_CBT.Polux\TestPolux\TestPolux.iOS\Main.cs:19
The app has been terminated.
Failed to Stop app:  An error occured on client IDB471038 while executing a reply for topic xvs/idb/4.7.10.38/stop-app
The app has been terminated.


4 Replies

GA Gasser November 13, 2017 03:12 PM UTC

One more precision: this error occurs only on iPhone 5 version 10.3.3 (14G60), but not on simulator (iPhone 5s - iOS 11.1)



MC Mohan Chandran Syncfusion Team November 14, 2017 08:47 AM UTC

Hi Gasser, 
 
Thank you for contacting Syncfusion support. 
  
From your given details, we are suspecting that this exception occurs due to the different Linking Behavior set in the project. In Xamarin, when supported architecture is set to ARMv7 (which is 32 bit architecture which has some file size restrictions), linking error occurs in compilation or the runtime exception will be thrown (i.e. iPhone 5 is an ARMv7 architecture). In ARM64 architecture, this issues will not occur (i.e. iPhone 5s is an ARMv64 architecture). 
 
So we kindly request you to try the steps given in the below KB to resolve this issue. 
 
 
If the issue still persists, please share us the build and debug settings screen-shot of your project which will be helpful for us to give you a prompt solution at the earliest. 
  
Regards, 
Mohan Chandran. 



GA Gasser November 14, 2017 10:23 AM UTC

Hello Mohan,

Thank you for the support, disabling debugging did the trick.

Thank you very much.

Greetings

J-D Gasser




MC Mohan Chandran Syncfusion Team November 15, 2017 06:16 AM UTC

Hi Gasser, 
  
We are glad that the issue is resolved at your end. Please let us know if you have any other queries. 
  
Regards, 
Mohan Chandran. 


Loader.
Up arrow icon