System.ThrowHelper.ThrowInvalidOperationException(ExceptionResource resource)

Praveen.BPraveen.B INMember ✭✭

I am developing an app in Xamarin.Forms (iOS) .In that i am getting frequent crashes with log message as follows:

at System.ThrowHelper.ThrowInvalidOperationException (System.ExceptionResource resource) [0x00000] in /Library/Frameworks/Xamarin.iOS.framework/Versions/11.12.0.4/src/Xamarin.iOS/mcs/class/referencesource/mscorlib/system/throwhelper.cs:104 at System.Collections.Generic.List1+Enumerator[T].MoveNextRare () [0x00013] in :0
at System.Collections.Generic.List1+Enumerator[T].MoveNext () [0x0004a] in <b238a3153e534349ad10ed0787f2157a>:0 at Xamarin.Forms.Picker.ResetItems () [0x00045] in C:\BuildAgent3\work\ca3766cfc22354a1\Xamarin.Forms.Core\Picker.cs:176 at Xamarin.Forms.Picker.OnItemsSourceChanged (System.Collections.IList oldValue, System.Collections.IList newValue) [0x0004c] in C:\BuildAgent3\work\ca3766cfc22354a1\Xamarin.Forms.Core\Picker.cs:136 at Xamarin.Forms.Picker.OnItemsSourceChanged (Xamarin.Forms.BindableObject bindable, System.Object oldValue, System.Object newValue) [0x00000] in C:\BuildAgent3\work\ca3766cfc22354a1\Xamarin.Forms.Core\Picker.cs:120 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) [0x00108] in C:\BuildAgent3\work\ca3766cfc22354a1\Xamarin.Forms.Core\BindableObject.cs:596 at Xamarin.Forms.BindableObject.SetValueCore (Xamarin.Forms.BindableProperty property, System.Object value, Xamarin.Forms.Internals.SetValueFlags attributes, Xamarin.Forms.BindableObject+SetValuePrivateFlags privateAttributes) [0x0015b] in C:\BuildAgent3\work\ca3766cfc22354a1\Xamarin.Forms.Core\BindableObject.cs:390 at Xamarin.Forms.BindingExpression.ApplyCore (System.Object sourceObject, Xamarin.Forms.BindableObject target, Xamarin.Forms.BindableProperty property, System.Boolean fromTarget) [0x001f9] in C:\BuildAgent3\work\ca3766cfc22354a1\Xamarin.Forms.Core\BindingExpression.cs:174 at Xamarin.Forms.BindingExpression.Apply (System.Boolean fromTarget) [0x0003e] in C:\BuildAgent3\work\ca3766cfc22354a1\Xamarin.Forms.Core\BindingExpression.cs:56 at Xamarin.Forms.BindingExpression+BindingExpressionPart.<PropertyChanged>b__47_0 () [0x00000] in C:\BuildAgent3\work\ca3766cfc22354a1\Xamarin.Forms.Core\BindingExpression.cs:551 at Foundation.NSAsyncActionDispatcher.Apply () [0x00000] in /Library/Frameworks/Xamarin.iOS.framework/Versions/11.12.0.4/src/Xamarin.iOS/Foundation/NSAction.cs:125 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/11.12.0.4/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/11.12.0.4/src/Xamarin.iOS/UIKit/UIApplication.cs:6

Anyone please help me to solve this issue.Thanks in advance.

Answers

  • Isha_DawarIsha_Dawar INMember ✭✭

    @Praveen.B Have you been using any picker listview at starting Page of you application?

  • Praveen.BPraveen.B INMember ✭✭

    Hi @Isha_Dawar . Thank you for your response. Yes, I am using a picker in the page.And also that is not in the first page of the app. While navigation from Page-1 to Page-2 the app is getting crashed sometimes. Page-2 contains 2 pickers for sure and a picker in listview (Which is set to visibility false most of the times). Can you please provide me some solution for this issue.

  • Isha_DawarIsha_Dawar INMember ✭✭
    edited August 2018

    @Praveen.B Can you share the code where you had bind items to picker

  • Praveen.BPraveen.B INMember ✭✭
    edited August 2018

    That class almost contains around 5000 lines of code. I bind the List of items to picker
    eg:

     List<string> Employees=new List<string>();
    
     var employees=new List<string>();
    
     foreach(var employee in employeesListFromServer)
     {
        employees.Add(employee);
     }
    
     Employees=employees;
    

    This is the way I bind the items to picker.
    NOTE: employeesListFromServer contains the list of strings from database.

  • Isha_DawarIsha_Dawar INMember ✭✭
    edited August 2018

    you can also keep this code in try/catch to see what the exception is occurring.and also while adding items to picker first clear the picker items as picker.Items.Clear()

Sign In or Register to comment.