Unplanned
Last Updated: 27 Feb 2025 14:22 by Martin Ivanov
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);

0 comments