This question is locked. New answers and comments are not allowed.
After upgrading to new version (2012.2.725.1050) from (2012..507.1050) we started to get an exception in grids with column header groups. Here is the stack trace:
System.NullReferenceException: Object reference not set to an instance of an object.
at Telerik.Windows.Controls.GridView.CommonHeaderPresenter.RealizeHeadersAtRow(Int32 row, List`1 subHeaders)
at Telerik.Windows.Controls.GridView.CommonHeaderPresenter.RealizeHeaders()
at Telerik.Windows.Controls.GridView.CommonHeaderPresenter.PlaceCommonHeaders()
at Telerik.Windows.Controls.GridView.CommonHeaderPresenter.OnApplyTemplate()
at System.Windows.FrameworkElement.OnApplyTemplate(IntPtr nativeTarget)
I checked the RealizeHeadersAtRow method with ILSpy and noticed that commonColumnHeader is only initialized under certain conditions. So, I guess that is the real cause of the null reference exception.
ILSpy output:
Is this something we can workaround?
Please advise,
Thanks.
System.NullReferenceException: Object reference not set to an instance of an object.
at Telerik.Windows.Controls.GridView.CommonHeaderPresenter.RealizeHeadersAtRow(Int32 row, List`1 subHeaders)
at Telerik.Windows.Controls.GridView.CommonHeaderPresenter.RealizeHeaders()
at Telerik.Windows.Controls.GridView.CommonHeaderPresenter.PlaceCommonHeaders()
at Telerik.Windows.Controls.GridView.CommonHeaderPresenter.OnApplyTemplate()
at System.Windows.FrameworkElement.OnApplyTemplate(IntPtr nativeTarget)
I checked the RealizeHeadersAtRow method with ILSpy and noticed that commonColumnHeader is only initialized under certain conditions. So, I guess that is the real cause of the null reference exception.
ILSpy output:
private List<CommonColumnHeader> RealizeHeadersAtRow(int row, List<CommonColumnHeader> subHeaders){ GridViewColumnGroup gridViewColumnGroup = null; CommonColumnHeader commonColumnHeader = null; int num = 0; int num2 = 0; int columnCountToRealize = this.GetColumnCountToRealize(subHeaders); for (int i = 0; i < columnCountToRealize; i++) { string groupNameByIndex = this.GetGroupNameByIndex(subHeaders, i); GridViewColumnGroup gridViewColumnGroup2 = CommonHeaderPresenter.FindGroupByName(groupNameByIndex, this.ColumnGroups); if (gridViewColumnGroup != gridViewColumnGroup2 || string.IsNullOrEmpty(groupNameByIndex)) { num = 0; gridViewColumnGroup = gridViewColumnGroup2; commonColumnHeader = this.RealizeHeaderForGroup(gridViewColumnGroup2, row, num2); } int subItemsSpan = CommonHeaderPresenter.GetSubItemsSpan(subHeaders, i); num += subItemsSpan; num2 += subItemsSpan; commonColumnHeader.SetValue(Grid.ColumnSpanProperty, num); } return Enumerable.ToList<CommonColumnHeader>(Enumerable.Where<CommonColumnHeader>(this.realizedHeaders, (CommonColumnHeader header) => header.RowIndex == row));}Is this something we can workaround?
Please advise,
Thanks.