MeasureCell - NullReferenceException

2 posts, 0 answers
  1. Michiel
    Michiel avatar
    5 posts
    Member since:
    Mar 2015

    Posted 01 Apr 2015 Link to this post

    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: )

    => 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)

    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,
  2. Vladislav
    Vladislav avatar
    274 posts

    Posted 03 Apr 2015 Link to this post

    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.


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

Back to Top