This is a migrated thread and some comments may be shown as answers.

MeasureCell - NullReferenceException

1 Answer 44 Views
DataGrid
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Michiel
Top achievements
Rank 1
Michiel asked on 01 Apr 2015, 12:14 PM
When testing the datagrid control I ran into some unhandled exceptions crashing my app.

My current reproduction of the issue is slightly extreme but it easily throws the exception.
(project reproducing this issue can be downloaded here: https://dl.dropboxusercontent.com/u/2679266/DataGrid.zip )

=> setup:
  datagrid with several templatedcolumns
  cellcontenttemplate: textbox

=> enough columns to enable scrolling (or alternatively make window small enough to enable scrolling)

=> when scrolling a bit forward and going back the exception is thrown (also when scrolling forward very fast)


Stacktrace:
System.NullReferenceException: Object reference not set to an instance of an object.
   at Telerik.UI.Xaml.Controls.Grid.RadDataGrid.MeasureCell(GridCellModel cell)
   at Telerik.UI.Xaml.Controls.Grid.RadDataGrid.Telerik.Core.IElementPresenter.MeasureContent(Object owner, Object content)
   at Telerik.UI.Xaml.Controls.Grid.Model.GridModel.Telerik.UI.Xaml.Controls.Grid.ITable.Measure(Node node)
   at Telerik.UI.Xaml.Controls.Grid.CellsController`1.MeasureCellDecorator(T cellDecorator)
   at Telerik.UI.X


When I linked the actual sourcecode in my project this happenedin the MeasureCell(GridCellModel cell) method in the RadDataGrid.Model.cs class.
=> cell.Column is null in this case => nullreference exception


Initially this was tested on the 2014 v3 controls (so the stacktrace might be a bit off on the latest version) but I just tested this with the 2015 dll's as well and the crash happens there too.

In my actual app I wouldn't need everything to be a textbox at the same time. I tried to minimize this in a different project (by using a usercontrol that toggled between templates) and even though the exceptions stayed away longer, they still sometimes occurred.

I do actually need the flexibility of datatemplates so using numeric/text columns is not an option for me.

Could someone have a look at this issue and see if there's a fix possible?

Thank you,
Michiel

1 Answer, 1 is accepted

Sort by
0
Vladislav
Telerik team
answered on 03 Apr 2015, 08:40 AM
Hi Michiel,

Thank you for this report. We confirm that this is a bug in the RadDataGrid control.
We logged it and will do our best to provide a fix for it in some of our future releases.

Your Telerik points are updated accordingly.

Regards,
Vladislav
Telerik
 

See What's Next in App Development. Register for TelerikNEXT.

 
Tags
DataGrid
Asked by
Michiel
Top achievements
Rank 1
Answers by
Vladislav
Telerik team
Share this question
or