Completed
Last Updated: 11 Dec 2019 13:35 by ADMIN
Release LIB 2019.3.1216 (12/16/2019)
ADMIN
Tanya
Created on: 22 Dec 2015 13:49
Category: RichTextBox
Type: Bug Report
2
RichTextBox: StackOverflowException/ArgumentException on DOCX import when bookmark range end is last in a block
When trying to import a document containing bookmark and BookmarkRangeEnd is after the last paragraph, a StackOverflowException is thrown in IntervalNode while trying to rebuild the document cache. (RadDocumentChildrenCache.RebuildTree()).

The same could be observed if the bookmark end is last in the header/footer, between table cells in the RadDocument body, or when all paragraphs after the bookmark range end are hidden (with vanish property).

Workaround: Detect the problematic annotations and remove them:
foreach (var rangeStart in document.EnumerateChildrenOfType<AnnotationRangeStart>())
{
    if (rangeStart.End == null || rangeStart.End.Parent == null || rangeStart.End.Parent.Parent == null)
    {
        //MessageBox.Show("This indicates a problem.");
        rangeStart.Parent.Children.Remove(rangeStart);
    }
}

Note: Until 2017 R2 SP1 release StackOverflowException is thrown, after this release an ArgumentException should be thrown.
0 comments