BoldSignA modern eSignature application with affordable pricing. Sign up today for unlimited document usage!
Hi everybody,
scrolling inside a datagrid leads to a NullReferenceException. I can see no differences between that grid and other ones where scrolling works. It's a quite simple view:
The datagrid is full of items, so scrolling is enabled. However when I reach the bottom, the app crashs.
That's the stacktrace:
GridGroupSummaryCellRenderer.CanUpdateBinding (Syncfusion.SfDataGrid.XForms.DataColumnBase dataColumnBase)
DataColumnBase.OnRowDataChanged ()
DataRowBase+<>c.<OnRowDataChanged>b__79_0 (Syncfusion.SfDataGrid.XForms.DataColumnBase col)
List`1[T].ForEach (System.Action`1[T] action)
DataRowBase.OnRowDataChanged ()
DataRowBase.set_RowData (System.Object value)
RowGenerator.UpdateDataRow (System.Collections.Generic.IEnumerable`1[T] rows, System.Int32 rowIndex, Syncfusion.SfDataGrid.XForms.RowRegion region)
RowGenerator.UpdateRow (System.Collections.Generic.IEnumerable`1[T] rows, System.Int32 rowIndex, Syncfusion.SfDataGrid.XForms.RowRegion region)
RowGenerator.EnsureRows (Syncfusion.GridCommon.ScrollAxis.VisibleLinesCollection visibleRows, Syncfusion.GridCommon.ScrollAxis.VisibleLinesCollection visibleColumns)
VisualContainer.EnsureItems (System.Boolean needToRefresh)
VisualContainer.OnSizeAllocated (System.Double width, System.Double height)
VisualElement.SizeAllocated (System.Double width, System.Double height)
And that's a bit weird, there is no group summary and the row data is not changed.
SfDataGrid Version: 18.4.0.43
Hi Maria,
We have checked the reported crash “NullReferenceException when scrolling through grid” , we are unable to reproduce the crash at our end . we have checked the Syncfusion.Xamarin.SfDataGrid version 18.4.0.43.we are unable to reproduce the crash. Please share the below details which would be more helpful for us to find the solution as soon as possible.
Also we have shared the sample for your reference, please have a look on it and let us know if we have missed any customization done in your sample, if possible modify the sample to reproduce the issue and find the solution as soon as possible.
Regards,
Suthi Yuvaraj.
Hi,
I reduced the datagrid's columns and inserted one column after another. As soon as I integrated the
GridDateTimeColumn, the app crashes while scrolling through the dataset. When I remove the column, everything works fine.
The datagrid is quite simple:
<sfgrid:SfDataGrid x:Name="dgItems"
ItemsSource="{Binding Items}"
AutoGenerateColumns="False"
AllowSorting="True"
ColumnSizer="Star">
<sfgrid:SfDataGrid.Columns>
<sfgrid:GridTextColumn HeaderText="Name" MappingName="Name" />
<sfgrid:GridDateTimeColumn HeaderText="Verfall" MappingName="Mhd" Width="80" />
</sfgrid:SfDataGrid.Columns>
</sfgrid:SfDataGrid>
Maria,
We regert to inform you that we are unable to
reproduce the crash at our end. We have checked with the inserting the GridDateTimeColumn,
issue is not reproduced in the reported version. We have attached the sample for
reference , please have a look on the sample and let us know if we have missed
any customization , that done in your sample. Also please share the Platform related
details which would be more helpful for us to find the
solution as soon as possible
Hi folks,
I have an update on this topic:
The datagrid contains a custom cell type which leads to the exception. The custom type is an entry with the telephone keyboard layout so the user is able to just enter numbers or dates:
public class GridTextNumericKeyboard : GridColumn
{
public GridTextNumericKeyboard()
{
this.LoadUIView = true;
var cellType = typeof(GridColumn).GetRuntimeProperties().FirstOrDefault((property) => property.Name == "CellType");
cellType.SetValue(this, "GridTextNumericKeyboard");
}
}
public class GridCellNumericTextRendererExt : GridCellTextViewRenderer
{
private SfDataGrid _datagrid;
public GridCellNumericTextRendererExt(SfDataGrid datagrid)
{
this._datagrid = datagrid;
}
protected override SfEntry OnCreateEditUIView()
{
var view = new GridTextbox(_datagrid);
view.Completed += View_Completed;
view.Unfocused += View_Unfocused;
view.Keyboard = Keyboard.Telephone;
return view;
}
private async void View_Unfocused(object sender, FocusEventArgs e)
{
await Task.Delay(10);
this.DataGrid.EndEdit();
}
private async void View_Completed(object sender, EventArgs e)
{
await Task.Delay(10);
this.DataGrid.EndEdit();
}
public override void OnInitializeDisplayView(DataColumnBase dataColumn, SfLabel view)
{
base.OnInitializeDisplayView(dataColumn, view);
}
public override void OnUpdateDisplayValue(DataColumnBase dataColumn, SfLabel view)
{
base.OnInitializeDisplayView(dataColumn, view);
}
}
As soon as the this column typ is used, scrolling leads to the exception.
My very dirty workaround: I created a new GridGroupSummaryCellRenderer and I overwrote the CanUpdateBinding-Method where I catch the occurring NullReferenceException:
public class GroupSummaryNoNullreference : GridGroupSummaryCellRenderer
{
public GroupSummaryNoNullreference() : base()
{
}
public override bool CanUpdateBinding(DataColumnBase dataColumnBase)
{
bool _response = false;
try
{
_response = base.CanUpdateBinding(dataColumnBase);
}
catch (NullReferenceException ex)
{
Helpers.Helpers.Log(nameof(CanUpdateBinding), ex.Message);
}
catch (Exception)
{
throw;
}
return _response;
}
}
Im not happy with that, but the app doesn't crash anymore :)
Maria, We tested the scenario you described using a simple SfDataGrid sample and the code snippets you provided. However, we were unable to replicate the reported scenario on our end. While scrolling, we did not encounter any “System.NullReferenceException" errors. For your convenience, we have attached a sample that we used for testing. Please check the sample to see if we missed any customizations you made in your application, or revert to us with a modified sample so that we can reproduce the reported issue. Could you please confirm that you are experiencing the same issue with the most recent SfDataGrid version as well? It will be more helpful for us to provide a timely solution.