Last Updated: 31 Oct 2018 07:54 by ADMIN
Created on: 22 Dec 2015 13:49
Category: RichTextBox
Type: Bug Report
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.");

Note: Until 2017 R2 SP1 release StackOverflowException is thrown, after this release an ArgumentException should be thrown.
(Total attached files size should be smaller than 20mb. Allowed extensions: .zip, .rar, .jpg, .png, .gif)