Declined
Last Updated: 22 Apr 2025 05:25 by ADMIN
Martin Ivanov
Created on: 27 Feb 2025 14:22
Category: RichTextBox
Type: Bug Report
1
RichTextBox: NullReferenceException on measure of the RadDocument after table rows were removed using the table.Rows.Remove method

NullReferenceException is thrown when the document gets updated after TableRow objects were removed with the Remove method of the parent Rows collection of the Table.

The table.Rows.Remove method is not properly removing some of the rows.

Stacktrace:

Telerik.Windows.Documents.dll!Telerik.Windows.Documents.Model.TableGridMeasurer.CalculateTableCellMinMaxWidths(Telerik.Windows.Documents.Model.TableCell cell, float availableWidth) Line 137 C#  Telerik.Windows.Documents.dll!Telerik.Windows.Documents.Model.TableGridMeasurer.CalculateTableMinMaxWidths(Telerik.Windows.Documents.Model.Table table, float availableWidth) Line 165 C#  Telerik.Windows.Documents.dll!Telerik.Windows.Documents.Model.TableGridMeasurer.MeasureAutoFit(Telerik.Windows.Documents.Model.Table table, float availableWidth) Line 229 C#
  Telerik.Windows.Documents.dll!Telerik.Windows.Documents.Model.Table.RecalculateColumnWidths(float measureWidth) Line 1151 C#
  Telerik.Windows.Documents.dll!Telerik.Windows.Documents.Model.Table.RecalculateTableGrid(float measureWidth) Line 1249 C#  Telerik.Windows.Documents.dll!Telerik.Windows.Documents.Layout.TableLayoutBox.MeasureOverride(Telerik.Windows.Documents.Model.SizeF availableSize) Line 265 C#  Telerik.Windows.Documents.dll!Telerik.Windows.Documents.Layout.LayoutElement.MeasureCore(Telerik.Windows.Documents.Model.SizeF availableSize) Line 933 C#  Telerik.Windows.Documents.dll!Telerik.Windows.Documents.Layout.LayoutElement.Measure(Telerik.Windows.Documents.Model.SizeF availableSize) Line 836 C#  Telerik.Windows.Documents.dll!Telerik.Windows.Documents.Layout.SectionLayoutBox.MeasureOverrideInternal(Telerik.Windows.Documents.Model.SizeF availableSize) Line 721 C#  Telerik.Windows.Documents.dll!Telerik.Windows.Documents.Layout.SectionLayoutBox.MeasureOverride(Telerik.Windows.Documents.Model.SizeF availableSize) Line 468 C#  Telerik.Windows.Documents.dll!Telerik.Windows.Documents.Layout.LayoutElement.MeasureCore(Telerik.Windows.Documents.Model.SizeF availableSize) Line 933 C#  Telerik.Windows.Documents.dll!Telerik.Windows.Documents.Layout.LayoutElement.Measure(Telerik.Windows.Documents.Model.SizeF availableSize) Line 836 C#  Telerik.Windows.Documents.dll!Telerik.Windows.Documents.Layout.DocumentLayoutBox.MeasureOverrideInternal(Telerik.Windows.Documents.Model.SizeF availableSize) Line 223 C#  Telerik.Windows.Documents.dll!Telerik.Windows.Documents.Layout.DocumentLayoutBox.MeasureOverride(Telerik.Windows.Documents.Model.SizeF availableSize) Line 150 C#  Telerik.Windows.Documents.dll!Telerik.Windows.Documents.Layout.LayoutElement.MeasureCore(Telerik.Windows.Documents.Model.SizeF availableSize) Line 933 C#  Telerik.Windows.Documents.dll!Telerik.Windows.Documents.Layout.LayoutElement.Measure(Telerik.Windows.Documents.Model.SizeF availableSize) Line 836 C#  Telerik.Windows.Documents.dll!Telerik.Windows.Documents.Model.RadDocument.Measure(Telerik.Windows.Documents.Model.SizeF measureSize) Line 1515 C#  Telerik.Windows.Documents.dll!Telerik.Windows.Documents.UI.DocumentPrintLayoutPresenter.MeasureOverride(System.Windows.Size availableSize) Line 714 C#

To work this around, use the DeleteTableRow method of the RadDocumentEditor.

RadDocumentEditor documentEditor = new RadDocumentEditor(document);
documentEditor.DeleteTableRow(row);

1 comment
ADMIN
Martin Ivanov
Posted on: 22 Apr 2025 05:25

Hello,

We further reviewed the problem and decided to decline the report. This is because it turned out that removing/adding rows alone doesn't trigger few necessary actions related to the proper document arrange/measure phase. These are related to internal code. Also, patching the problem may lead to other issues. In the general case, we strongly suggest to avoid modifying the content of the RadDocument directly. Instead, use the RadDocumentEditor always when possible. 

Regards,
Martin Ivanov
Progress Telerik

Love the Telerik and Kendo UI products and believe more people should try them? Invite a fellow developer to become a Progress customer and each of you can get a $50 Amazon gift voucher.