We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date
close icon

DataGrid crash on Android Emulator

Not sure what went wrong building a similar grid to what is provided in the getting started samples.

Source:Syncfusion.SfDataGrid.XForms.Android

Message:Object reference not set to an instance of an object.



StackTrace:


 at Syncfusion.SfDataGrid.XForms.Droid.ExtendedScrollViewRenderer.OnElementChanged (Xamarin.Forms.Platform.Android.ElementChangedEventArgs`1[TElement] e) [0x00061] in <1487a5e7689343e7b83a475cfa3794bb>:0
  at Xamarin.Forms.Platform.Android.VisualElementRenderer`1[TElement].SetElement (TElement element) [0x000f4] in C:\BuildAgent3\work\ca3766cfc22354a1\Xamarin.Forms.Platform.Android\VisualElementRenderer.cs:193
  at Xamarin.Forms.Platform.Android.VisualElementRenderer`1[TElement].Xamarin.Forms.Platform.Android.IVisualElementRenderer.SetElement (Xamarin.Forms.VisualElement element) [0x00027] in C:\BuildAgent3\work\ca3766cfc22354a1\Xamarin.Forms.Platform.Android\VisualElementRenderer.cs:129
  at Xamarin.Forms.Platform.Android.Platform.CreateRenderer (Xamarin.Forms.VisualElement element) [0x0001f] in C:\BuildAgent3\work\ca3766cfc22354a1\Xamarin.Forms.Platform.Android\Platform.cs:289
  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) [0x00023] in C:\BuildAgent3\work\ca3766cfc22354a1\Xamarin.Forms.Platform.Android\VisualElementPackager.cs:74
  at Xamarin.Forms.Platform.Android.VisualElementPackager.SetElement (Xamarin.Forms.VisualElement oldElement, Xamarin.Forms.VisualElement newElement) [0x00104] in C:\BuildAgent3\work\ca3766cfc22354a1\Xamarin.Forms.Platform.Android\VisualElementPackager.cs:207
  at Xamarin.Forms.Platform.Android.VisualElementPackager.Load () [0x00000] in C:\BuildAgent3\work\ca3766cfc22354a1\Xamarin.Forms.Platform.Android\VisualElementPackager.cs:58
  at Xamarin.Forms.Platform.Android.VisualElementRenderer`1[TElement].SetPackager (Xamarin.Forms.Platform.Android.VisualElementPackager packager) [0x00007] in C:\BuildAgent3\work\ca3766cfc22354a1\Xamarin.Forms.Platform.Android\VisualElementRenderer.cs:337
  at Xamarin.Forms.Platform.Android.VisualElementRenderer`1[TElement].SetElement (TElement element) [0x00111] in C:\BuildAgent3\work\ca3766cfc22354a1\Xamarin.Forms.Platform.Android\VisualElementRenderer.cs:196
  at Xamarin.Forms.Platform.Android.VisualElementRenderer`1[TElement].Xamarin.Forms.Platform.Android.IVisualElementRenderer.SetElement (Xamarin.Forms.VisualElement element) [0x00027] in C:\BuildAgent3\work\ca3766cfc22354a1\Xamarin.Forms.Platform.Android\VisualElementRenderer.cs:129
  at Xamarin.Forms.Platform.Android.Platform.CreateRenderer (Xamarin.Forms.VisualElement element) [0x0001f] in C:\BuildAgent3\work\ca3766cfc22354a1\Xamarin.Forms.Platform.Android\Platform.cs:289
  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) [0x00023] in C:\BuildAgent3\work\ca3766cfc22354a1\Xamarin.Forms.Platform.Android\VisualElementPackager.cs:74
  at Xamarin.Forms.Platform.Android.VisualElementPackager.SetElement (Xamarin.Forms.VisualElement oldElement, Xamarin.Forms.VisualElement newElement) [0x00104] in C:\BuildAgent3\work\ca3766cfc22354a1\Xamarin.Forms.Platform.Android\VisualElementPackager.cs:207
  at Xamarin.Forms.Platform.Android.VisualElementPackager.Load () [0x00000] in C:\BuildAgent3\work\ca3766cfc22354a1\Xamarin.Forms.Platform.Android\VisualElementPackager.cs:58
  at Xamarin.Forms.Platform.Android.VisualElementRenderer`1[TElement].SetPackager (Xamarin.Forms.Platform.Android.VisualElementPackager packager) [0x00007] in C:\BuildAgent3\work\ca3766cfc22354a1\Xamarin.Forms.Platform.Android\VisualElementRenderer.cs:337
  at Xamarin.Forms.Platform.Android.VisualElementRenderer`1[TElement].SetElement (TElement element) [0x00111] in C:\BuildAgent3\work\ca3766cfc22354a1\Xamarin.Forms.Platform.Android\VisualElementRenderer.cs:196
  at Xamarin.Forms.Platform.Android.VisualElementRenderer`1[TElement].Xamarin.Forms.Platform.Android.IVisualElementRenderer.SetElement (Xamarin.Forms.VisualElement element) [0x00027] in C:\BuildAgent3\work\ca3766cfc22354a1\Xamarin.Forms.Platform.Android\VisualElementRenderer.cs:129
  at Xamarin.Forms.Platform.Android.Platform.CreateRenderer (Xamarin.Forms.VisualElement element) [0x0001f] in C:\BuildAgent3\work\ca3766cfc22354a1\Xamarin.Forms.Platform.Android\Platform.cs:289
  at Xamarin.Forms.Platform.Android.AppCompat.Platform.AddChild (Xamarin.Forms.Page page, System.Boolean layout) [0x00015] in C:\BuildAgent3\work\ca3766cfc22354a1\Xamarin.Forms.Platform.Android\AppCompat\Platform.cs:250
  at Xamarin.Forms.Platform.Android.AppCompat.Platform.SetPage (Xamarin.Forms.Page newRoot) [0x00089] in C:\BuildAgent3\work\ca3766cfc22354a1\Xamarin.Forms.Platform.Android\AppCompat\Platform.cs:239
  at Xamarin.Forms.Platform.Android.FormsAppCompatActivity.InternalSetPage (Xamarin.Forms.Page page) [0x0009b] in C:\BuildAgent3\work\ca3766cfc22354a1\Xamarin.Forms.Platform.Android\AppCompat\FormsAppCompatActivity.cs:374
  at Xamarin.Forms.Platform.Android.FormsAppCompatActivity.SetMainPage () [0x00000] in C:\BuildAgent3\work\ca3766cfc22354a1\Xamarin.Forms.Platform.Android\AppCompat\FormsAppCompatActivity.cs:444
  at Xamarin.Forms.Platform.Android.FormsAppCompatActivity.LoadApplication (Xamarin.Forms.Application application) [0x00183] in C:\BuildAgent3\work\ca3766cfc22354a1\Xamarin.Forms.Platform.Android\AppCompat\FormsAppCompatActivity.cs:135
  at MeetnGreetSf.Droid.MainActivity.OnCreate (Android.OS.Bundle bundle) [0x00027] in C:\VS2017 Projects\MeetnGreetSf\MeetnGreetSf\MeetnGreetSf.Android\MainActivity.cs:23
  at Android.Support.V4.App.FragmentActivity.n_OnCreate_Landroid_os_Bundle_ (System.IntPtr jnienv, System.IntPtr native__this, System.IntPtr native_savedInstanceState) [0x00011] in <7a2a36256f1648ecbd0c15a75bc5a349>:0
  at (wrapper dynamic-method) System.Object:92aaf170-9fc3-4531-93b1-ee78b9e28f1b (intptr,intptr,intptr)

3 Replies

VP Vimal Prabhu Manohkaran Syncfusion Team March 29, 2017 09:41 AM UTC

Hi Chris, 
 
Thanks for contacting Syncfusion support. We kindly request you to ensure the below mentioned things and revert us.  
  
1.     If your crash occurs only when you set SfDataGrid.OverScrollMode to none , this is because, an enhancement code for the android scroller was unfortunately not included in the Service Pack release which was rolled out. Hence we included that code and made it available in the online nugets which were refreshed few days after the release. Hence please do the following.

1. Uninstall / remove all references to SfDataGrid from all projects of your solution.

2. Close the solution, and in the file explorer ,clear the bin and obj folders of all the projects in your solution and remove the Syncfusion packages from the packages folder present in your solution.

3. Now open the solution and reinstall the latest version of Syncfusion nugets for SfDataGrid.XForms. If you have not installed Syncfusion nugets before, you may have to configure the Nuget Package Manager . Please refer the below link to configure the same.

KB Link : https://help.syncfusion.com/xamarin/introduction/download-and-installation

 
 
2.     Might be because you have installed Xamarin.Android nugets instead of Xamarin.Forms nugets : Seeing the stack trace it is highly likely that you have installed the Xamarin.Android nuget packages by mistake. Please uninstall the Xamarin.Android nugets and install only the Xamarin.Forms nuget packages. Make sure you clean up the projects as mentioned in case 2 when uninstalling and reinstalling. Please refer the below screenshot, where green shows the nuget packages to be installed and red shows the nugets that should not be installed. For more information regarding the necessary references required to render the SfDataGrid, please refer the below link.

UG Link : https://help.syncfusion.com/xamarin/sfdatagrid/getting-started#assembly-deployment

 
 
  
 
3.     If your crash occurs only in an Android API 23 Marshmallow emulator, this is because , the x value of ScrollViewer we have used internally for Xamarin.Forms.Android returns with a wrong value causing the crash. We have used a custom ScrollViewer for scrolling in Android, where we have performed calculation to manually scroll the panel based on the velocity and fling. Here when trying to convert the CurrentX value of the ScrollViewer to an Absolute value(Math.Abs) , the x value is returned as a very big value which cannot be processed by the Math.Abs function.

However this wrong value is obtained only in the API 23 emulator. We have checked the same in all emulators and devices(Google Pixel ( API 24), Samsung Galaxy S6 (API 23) , Moto G4 plus ( API 23 and 24), Samsung Galaxy Tab A (API 23) , Moto E (API 19) and API 21 and 19 emulators) starting from API 19 and upwards  and we were able to get the correct X value as expected and the reported crash issue is not reproduced. Since this is an error in the emulator we are considering this as an IDE error and hence a source level fix is not applicable. However we are also checking for possible workarounds from our side to overcome this issue. We regret the inconvenience caused. 

 
 
 

In case your issue is not because of the above reasons and may persist, we kindly request you to setup a web meeting with us to look into it and provide the solution. Please let us know your availability. We will make every effort to have this scheduled on a date and time of your convenience.

Regards,
Vimal Prabhu 
 
 



CE Chris Erickson March 29, 2017 12:55 PM UTC

It was issue 2. I misread the getting started file requirements. Thanks for the catch and pointing it out.


VP Vimal Prabhu Manohkaran Syncfusion Team March 30, 2017 08:35 AM UTC

Hi Chris,

Thanks for the feedback. We are happy that your issue has been resolved. Please revert us in case of any other queries.

Regards
Vimal Prabhu 


Loader.
Live Chat Icon For mobile
Up arrow icon