SfDataGrid Exception has been thrown by the target of an invocation on Android 7 or older

Hi Syncfusion, I download your demo SfDataGrid here: https://github.com/syncfusion/xamarin-demos/tree/master/Forms/DataGrid

After that, I run it on Android 7 simulator, it is crashed which exception:

System.Reflection.TargetInvocationException: 'Exception has been thrown by the target of an invocation.'

Please check it.


P/s: If you run Debug mode ok, you should run on Release mode.

Thanks


Stack trace: 

  at System.Reflection.RuntimeConstructorInfo.InternalInvoke (System.Object obj, System.Object[] parameters, System.Boolean wrapExceptions) [0x0001d] in <fd13b860bbd7404b81d562f64a22e937>:0

  at System.Reflection.RuntimeConstructorInfo.DoInvoke (System.Object obj, System.Reflection.BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) [0x00086] in <fd13b860bbd7404b81d562f64a22e937>:0

  at System.Reflection.RuntimeConstructorInfo.Invoke (System.Reflection.BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) [0x00000] in <fd13b860bbd7404b81d562f64a22e937>:0

  at System.RuntimeType.CreateInstanceImpl (System.Reflection.BindingFlags bindingAttr, System.Reflection.Binder binder, System.Object[] args, System.Globalization.CultureInfo culture, System.Object[] activationAttributes, System.Threading.StackCrawlMark& stackMark) [0x0022b] in <fd13b860bbd7404b81d562f64a22e937>:0

  at System.Activator.CreateInstance (System.Type type, System.Reflection.BindingFlags bindingAttr, System.Reflection.Binder binder, System.Object[] args, System.Globalization.CultureInfo culture, System.Object[] activationAttributes) [0x0009c] in <fd13b860bbd7404b81d562f64a22e937>:0

  at System.Activator.CreateInstance (System.Type type, System.Object[] args) [0x00000] in <fd13b860bbd7404b81d562f64a22e937>:0

  at Xamarin.Forms.Internals.DependencyResolver.ResolveOrCreate (System.Type type, System.Object source, System.Type visualType, System.Object[] args) [0x000af] in <978ec34c5c9c4c4eb3d73b6da958bcd6>:0

  at Xamarin.Forms.Internals.Registrar`1[TRegistrable].GetHandler (System.Type type, System.Object source, Xamarin.Forms.IVisual visual, System.Object[] args) [0x00060] in <978ec34c5c9c4c4eb3d73b6da958bcd6>:0

  at Xamarin.Forms.Internals.Registrar`1[TRegistrable].GetHandlerForObject[TOut] (System.Object obj, System.Object[] args) [0x00041] in <978ec34c5c9c4c4eb3d73b6da958bcd6>:0

  at Xamarin.Forms.Platform.Android.Platform.CreateRenderer (Xamarin.Forms.VisualElement element, Android.Content.Context context) [0x00023] in <04c545f414d24a37af95d995791bb9a9>:0

  at Xamarin.Forms.Platform.Android.VisualElementPackager.AddChild (Xamarin.Forms.VisualElement view, Xamarin.Forms.Platform.Android.IVisualElementRenderer oldRenderer, Xamarin.Forms.Platform.Android.RendererPool pool, System.Boolean sameChildren) [0x000c4] in <04c545f414d24a37af95d995791bb9a9>:0

  at Xamarin.Forms.Platform.Android.VisualElementPackager.SetElement (Xamarin.Forms.VisualElement oldElement, Xamarin.Forms.VisualElement newElement) [0x0016c] in <04c545f414d24a37af95d995791bb9a9>:0

  at Xamarin.Forms.Platform.Android.VisualElementPackager.Load () [0x00000] in <04c545f414d24a37af95d995791bb9a9>:0

  at Xamarin.Forms.Platform.Android.VisualElementRenderer`1[TElement].SetPackager (Xamarin.Forms.Platform.Android.VisualElementPackager packager) [0x00007] in <04c545f414d24a37af95d995791bb9a9>:0

  at Xamarin.Forms.Platform.Android.VisualElementRenderer`1[TElement].SetElement (TElement element) [0x000f0] in <04c545f414d24a37af95d995791bb9a9>:0

  at Xamarin.Forms.Platform.Android.VisualElementRenderer`1[TElement].Xamarin.Forms.Platform.Android.IVisualElementRenderer.SetElement (Xamarin.Forms.VisualElement element) [0x00033] in <04c545f414d24a37af95d995791bb9a9>:0

  at Xamarin.Forms.Platform.Android.Platform.CreateRenderer (Xamarin.Forms.VisualElement element, Android.Content.Context context) [0x0003e] in <04c545f414d24a37af95d995791bb9a9>:0

  at Xamarin.Forms.Platform.Android.VisualElementPackager.AddChild (Xamarin.Forms.VisualElement view, Xamarin.Forms.Platform.Android.IVisualElementRenderer oldRenderer, Xamarin.Forms.Platform.Android.RendererPool pool, System.Boolean sameChildren) [0x000c4] in <04c545f414d24a37af95d995791bb9a9>:0

  at Xamarin.Forms.Platform.Android.VisualElementPackager.OnChildAdded (System.Object sender, Xamarin.Forms.ElementEventArgs e) [0x0000f] in <04c545f414d24a37af95d995791bb9a9>:0

  at Xamarin.Forms.Element.OnChildAdded (Xamarin.Forms.Element child) [0x00022] in <978ec34c5c9c4c4eb3d73b6da958bcd6>:0

  at Xamarin.Forms.VisualElement.OnChildAdded (Xamarin.Forms.Element child) [0x00000] in <978ec34c5c9c4c4eb3d73b6da958bcd6>:0

  at Xamarin.Forms.Layout`1[T].OnChildAdded (Xamarin.Forms.Element child) [0x00000] in <978ec34c5c9c4c4eb3d73b6da958bcd6>:0

  at Xamarin.Forms.Layout.OnInternalAdded (Xamarin.Forms.View view) [0x0001d] in <978ec34c5c9c4c4eb3d73b6da958bcd6>:0

  at Xamarin.Forms.Layout.InternalChildrenOnCollectionChanged (System.Object sender, System.Collections.Specialized.NotifyCollectionChangedEventArgs e) [0x00080] in <978ec34c5c9c4c4eb3d73b6da958bcd6>:0

  at (wrapper delegate-invoke) <Module>.invoke_void_object_NotifyCollectionChangedEventArgs(object,System.Collections.Specialized.NotifyCollectionChangedEventArgs)

  at System.Collections.ObjectModel.ObservableCollection`1[T].OnCollectionChanged (System.Collections.Specialized.NotifyCollectionChangedEventArgs e) [0x00018] in <60dc4369d68647159b0350d1423d21dd>:0

  at System.Collections.ObjectModel.ObservableCollection`1[T].OnCollectionChanged (System.Collections.Specialized.NotifyCollectionChangedAction action, System.Object item, System.Int32 index) [0x00009] in <60dc4369d68647159b0350d1423d21dd>:0

  at System.Collections.ObjectModel.ObservableCollection`1[T].InsertItem (System.Int32 index, T item) [0x0001a] in <60dc4369d68647159b0350d1423d21dd>:0

  at System.Collections.ObjectModel.Collection`1[T].Add (T item) [0x00020] in <fd13b860bbd7404b81d562f64a22e937>:0

  at Xamarin.Forms.ObservableWrapper`2[TTrack,TRestrict].Add (TRestrict item) [0x0004b] in <978ec34c5c9c4c4eb3d73b6da958bcd6>:0

  at Syncfusion.SfDataGrid.XForms.VisualContainer.EnsureItems (System.Boolean needToRefresh) [0x00170] in <3487b22c6d1b4bd798a690944845fdbd>:0

  at Syncfusion.SfDataGrid.XForms.VisualContainer.OnSizeAllocated (System.Double width, System.Double height) [0x00305] in <3487b22c6d1b4bd798a690944845fdbd>:0

  at Xamarin.Forms.VisualElement.SizeAllocated (System.Double width, System.Double height) [0x00000] in <978ec34c5c9c4c4eb3d73b6da958bcd6>:0

  at Xamarin.Forms.Layout.ForceLayout () [0x0000d] in <978ec34c5c9c4c4eb3d73b6da958bcd6>:0

  at Syncfusion.SfDataGrid.XForms.SfDataGrid.OnGridColumnCollectionChanged (System.Object sender, System.Collections.Specialized.NotifyCollectionChangedEventArgs e) [0x005b8] in <3487b22c6d1b4bd798a690944845fdbd>:0

  at System.Collections.ObjectModel.ObservableCollection`1[T].OnCollectionChanged (System.Collections.Specialized.NotifyCollectionChangedEventArgs e) [0x00018] in <60dc4369d68647159b0350d1423d21dd>:0

  at System.Collections.ObjectModel.ObservableCollection`1[T].OnCollectionChanged (System.Collections.Specialized.NotifyCollectionChangedAction action, System.Object item, System.Int32 index) [0x00009] in <60dc4369d68647159b0350d1423d21dd>:0

  at System.Collections.ObjectModel.ObservableCollection`1[T].InsertItem (System.Int32 index, T item) [0x0001a] in <60dc4369d68647159b0350d1423d21dd>:0

  at System.Collections.ObjectModel.Collection`1[T].Add (T item) [0x00020] in <fd13b860bbd7404b81d562f64a22e937>:0




9 Replies

KK Karthikraja Kalaimani Syncfusion Team July 8, 2021 06:39 AM UTC

Hi Nguyen, 

This is already a known issue, and it has been resolved. You can expect the fix in our next weekly nuget, which is scheduled for July 13th, 2021. Until then, we appreciate your patience.

Regards,
Karthik Raja



NK Nguyen Khoa Lu July 8, 2021 06:47 AM UTC

What is the minimum version which i can downgrade?

Thanks you.



KK Karthikraja Kalaimani Syncfusion Team July 9, 2021 06:49 AM UTC

Hi Nguyen, 

As of now, you can downgrade to v19.1.0.69. 

Regards,
Karthik Raja


NK Nguyen Khoa Lu replied to Karthikraja Kalaimani July 9, 2021 06:55 AM UTC

Release mode error with v19.1.0.69

Thanks



KK Karthikraja Kalaimani Syncfusion Team July 9, 2021 06:57 AM UTC

Hi Nguyen, 

Can you please show the error which you are facing in release mode ? 

Regards,
Karthik Raja


NK Nguyen Khoa Lu July 9, 2021 07:15 AM UTC

Thanks for reply, I try to write error to a text file. It show me same Exception in debug mode.

Check that file.

Thanks


Attachment: EXCEPTION_d1f8cff5.zip


KK Karthikraja Kalaimani Syncfusion Team July 12, 2021 10:38 AM UTC

Hi Nguyen,

The SfDataGrid is showing perfectly in v19.1.0.69 with Xamarin forms version 4.5.0.617. We have attached the screenshot for your reference.




 We suspect that still the SfDataGrid v19.2.0.44 is referenced in your project. So, only the same error your facing. So, can you please clear the bin and obj files in your project and let us know the details ?. 

Regards,
Karthik Raja


NK Nguyen Khoa Lu July 12, 2021 10:42 AM UTC

Thanks you, Deleting bin and obj has been solved.




KK Karthikraja Kalaimani Syncfusion Team July 13, 2021 04:25 AM UTC

Hi Nguyen, 

We glad to know that the previously provided update fixes your problem. Please let us know if you need further assistance from us.

Regards,
Karthik Raja

Loader.
Up arrow icon