Unplanned
Last Updated: 26 Aug 2019 11:41 by ADMIN
Desislava
Created on: 26 Aug 2019 11:40
Category: RichTextEditor
Type: Bug Report
0
RadRichTextEditor: 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