Error in iOS 12 : Specified argument was out of the range of valid values. Parameter name: index"

Hi,
I have a Xamarin.Forms app with Syncfusion.SFCalendar package  (version 16.1.0.37).
SFCalendar was working pretty well until I've updated iOS to the latest version iOS 12.

With Visual Studio for Mac debugging my app I got the error "Specified argument was out of the range of valid values. Parameter name: index" and following is the stack trace :

at Foundation.NSArray.GetItem[T] (System.nuint index) [0x00013] in <6a026a6503ca4935b5bb3ed241d053fe>:0
  at Syncfusion.SfCalendar.iOS.SFCalendar.set_VisibleDates (Foundation.NSMutableArray value) [0x0004c] in <322b8396bbb4422aa29d08ee3931f72a>:0
  at Syncfusion.SfCalendar.iOS.SFCalendar.UpdateVisibleDates (Foundation.NSDate date) [0x00259] in <322b8396bbb4422aa29d08ee3931f72a>:0
  at Syncfusion.SfCalendar.iOS.SFCalendar.InternalMoveToDate (Foundation.NSDate dateNeedToBeMoved) [0x000dc] in <322b8396bbb4422aa29d08ee3931f72a>:0
  at Syncfusion.SfCalendar.iOS.SFCalendar.MoveToMonthView () [0x0008b] in <322b8396bbb4422aa29d08ee3931f72a>:0
  at Syncfusion.SfCalendar.iOS.SFCalendar.UpdateCalendarType () [0x0008d] in <322b8396bbb4422aa29d08ee3931f72a>:0
  at Syncfusion.SfCalendar.iOS.SFCalendar..ctor () [0x0023f] in <322b8396bbb4422aa29d08ee3931f72a>:0
  at Syncfusion.SfCalendar.XForms.iOS.SfCalendarRenderer.OnElementChanged (Xamarin.Forms.Platform.iOS.ElementChangedEventArgs`1[TElement] e) [0x00065] in <40ef003074fc41fab98bdea61365bd4c>:0
  at Xamarin.Forms.Platform.iOS.VisualElementRenderer`1[TElement].SetElement (TElement element) [0x00118] in <bc5a3d4303744676b3b36f4254bb697d>:0
  at Xamarin.Forms.Platform.iOS.VisualElementRenderer`1[TElement].Xamarin.Forms.Platform.iOS.IVisualElementRenderer.SetElement (Xamarin.Forms.VisualElement element) [0x00000] in <bc5a3d4303744676b3b36f4254bb697d>:0
  at Xamarin.Forms.Platform.iOS.Platform.CreateRenderer (Xamarin.Forms.VisualElement element) [0x00014] in <bc5a3d4303744676b3b36f4254bb697d>:0
  at Xamarin.Forms.Platform.iOS.VisualElementPackager.OnChildAdded (Xamarin.Forms.VisualElement view) [0x0002a] in <bc5a3d4303744676b3b36f4254bb697d>:0
  at Xamarin.Forms.Platform.iOS.VisualElementPackager.Load () [0x0001e] in <bc5a3d4303744676b3b36f4254bb697d>:0
  at Xamarin.Forms.Platform.iOS.PageRenderer.ViewDidLoad () [0x00086] in <bc5a3d4303744676b3b36f4254bb697d>:0
  at (wrapper managed-to-native) ObjCRuntime.Messaging.IntPtr_objc_msgSendSuper(intptr,intptr)
  at UIKit.UIViewController.get_View () [0x0002a] in /Library/Frameworks/Xamarin.iOS.framework/Versions/12.0.0.15/src/Xamarin.iOS/UIKit/UIViewController.g.cs:2983
  at Xamarin.Forms.Platform.iOS.PageRenderer.get_NativeView () [0x00008] in <bc5a3d4303744676b3b36f4254bb697d>:0
  at Xamarin.Forms.Platform.iOS.PageRenderer.SetElement (Xamarin.Forms.VisualElement element) [0x0004f] in <bc5a3d4303744676b3b36f4254bb697d>:0
  at Xamarin.Forms.Platform.iOS.Platform.CreateRenderer (Xamarin.Forms.VisualElement element) [0x00014] in <bc5a3d4303744676b3b36f4254bb697d>:0
  at Xamarin.Forms.Platform.iOS.NavigationRenderer.CreateViewControllerForPage (Xamarin.Forms.Page page) [0x00008] in <bc5a3d4303744676b3b36f4254bb697d>:0
  at Xamarin.Forms.Platform.iOS.NavigationRenderer+<OnPushAsync>d__45.MoveNext () [0x00016] in <bc5a3d4303744676b3b36f4254bb697d>:0
--- End of stack trace from previous location where exception was thrown ---
  at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess (System.Threading.Tasks.Task task) [0x00037] in /Library/Frameworks/Xamarin.iOS.framework/Versions/12.0.0.15/src/Xamarin.iOS/mcs/class/referencesource/mscorlib/system/runtime/compilerservices/TaskAwaiter.cs:187
  at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (System.Threading.Tasks.Task task) [0x00028] in /Library/Frameworks/Xamarin.iOS.framework/Versions/12.0.0.15/src/Xamarin.iOS/mcs/class/referencesource/mscorlib/system/runtime/compilerservices/TaskAwaiter.cs:156
  at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd (System.Threading.Tasks.Task task) [0x00008] in /Library/Frameworks/Xamarin.iOS.framework/Versions/12.0.0.15/src/Xamarin.iOS/mcs/class/referencesource/mscorlib/system/runtime/compilerservices/TaskAwaiter.cs:128
  at System.Runtime.CompilerServices.TaskAwaiter`1[TResult].GetResult () [0x00000] in /Library/Frameworks/Xamarin.iOS.framework/Versions/12.0.0.15/src/Xamarin.iOS/mcs/class/referencesource/mscorlib/system/runtime/compilerservices/TaskAwaiter.cs:357
  at Xamarin.Forms.Platform.iOS.NavigationRenderer+<<ViewDidLoad>b__40_0>d.MoveNext () [0x00067] in <bc5a3d4303744676b3b36f4254bb697d>:0
--- End of stack trace from previous location where exception was thrown ---

Can you help please, or provide some samples that I could use with SFCalendar and  iOS 12 in a Xamarin.Forms application ?
With Android the same app works correctly.

Thanks,

Enrico.



5 Replies

VR Vigneshkumar Ramasamy Syncfusion Team October 3, 2018 11:38 AM UTC

Hi Enrico, 
 
Thank you for contacting Syncfusion Support. 
 
Based on the provided information, we have checked the issue with “Specified argument was out of the range of valid values. Parameter name: index on Xamarin. Forms (iOS) in iOS latest version 12.0” and it is working fine from our side. We have attached the output of the sample, please find the screenshot and sample from the below link 
 
 
 
If the given solution doesn’t meet your requirement, could you please revert to with more information about your requirement in detail, it will be helpful for us to check on it and provide you the better solution 
 
Regards,
Vigneshkumar R 
 



EM Enrico Marrai October 4, 2018 09:42 AM UTC

Hi Vigneshkumar R ,
thanks for yr help, I 've tested your sample and I can confirm that it works correctly on Android and iOS.

I have also prepared a prototype solution to investigate the problem I am trying to tackle and you can find it in the attached zip. 
The key points of this sample that are also involved in the real solution are :

SFCalendar 16.1.0.37
Xamarin.Forms 2.5
PCL project for the Xamarin.Forms solution

If you try the sample both on Android and on iOS 12 you should get a runtime error for iOS while for Android (8.0 in my case) it works correctly.

The run-time error I have captured for  iOS is different from the original error that I've submitted to this forum but anyway this is the stack trace :

Object reference not set to an instance of an object
  at Syncfusion.SfCalendar.iOS.SFCalendarMonthDayView.DrawBackground () [0x00bf1] in <322b8396bbb4422aa29d08ee3931f72a>:0
  at Syncfusion.SfCalendar.iOS.SFCalendarMonthDayView.Draw (CoreGraphics.CGRect rect) [0x000d1] in <322b8396bbb4422aa29d08ee3931f72a>: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 /Library/Frameworks/Xamarin.iOS.framework/Versions/12.0.0.15/src/Xamarin.iOS/UIKit/UIApplication.cs:79
  at UIKit.UIApplication.Main (System.String[] args, System.String principalClassName, System.String delegateClassName) [0x0002c] in /Library/Frameworks/Xamarin.iOS.framework/Versions/12.0.0.15/src/Xamarin.iOS/UIKit/UIApplication.cs:63

What I am missing with SFCalendar and iOS ?
In the sample I've provided you can verify that I've installed Xamarin.Forms 3.2 but the same error occurs with Xamarin.Forms 2.5.
I've also changed PCL profile (44 and 111) but the same error occurs.

Thanks again for yr help.

Enrico.


Attachment: TestCalendar1_ad12aaeb.zip


VR Vigneshkumar Ramasamy Syncfusion Team October 5, 2018 06:51 AM UTC

Hi Enrico,

Thanks for the update.

Based on the provided sample, we have checked the issue with “Getting Runtime error in SfCalendar on iOS” and it is working fine from our side. We have checked in the scenario of by using multiple versions of Xamarin. Forms. We have attached the output of the sample, please find the video from the below link.

Video link: http://www.syncfusion.com/downloads/support/forum/140151/ze/video1202943129.zip

Please clear the NuGet cache before deploying the sample. Please find the link below, 

https://www.syncfusion.com/kb/6987/how-to-clear-nuget-cache

If the given solution doesn’t meet your requirement, could you please revert to with more information about your requirement in detail, it will be helpful for us to check on it and provide you the better solution.

Regards,
Vigneshkumar R  



EM Enrico Marrai October 5, 2018 07:43 AM UTC

Hi Vigneshkumar R,
following your instructions I 've cleared nuget cache (https://www.syncfusion.com/kb/6987/how-to-clear-nuget-cache ).

Then I tested my sample project and the results are :

On iPhone 7  iOS 12.0 Simulator it works correctly as in your video clip.
On real device iPhone 7 iOS 12.0 crash with "Object reference not set to an instance of an object"
On real device iPhone 5S iOS 12.0 crash with "Object reference not set to an instance of an object"

This is a very strange behaviour, have you tested on a real device ?
If needed I will provide a video while running in debug mode on real device from Visual Studio for Mac.

Regards,

Enrico.



VR Vigneshkumar Ramasamy Syncfusion Team October 9, 2018 12:26 PM UTC

Hi Enrico,

A support incident to track the status of this defect has been created under your account. Please log on to our support website to check for further updates.


http://www.syncfusion.com/Account/Logon?ReturnUrl=%2fsupport%2fdirecttrac/  

Regards, 
Vigneshkumar R 


Loader.
Up arrow icon