Completed
Last Updated: 18 May 2023 12:12 by ADMIN
Release R2 2023
ADMIN
Tanya
Created on: 21 Mar 2016 16:34
Category: RichTextBox
Type: Bug Report
0
RichTextBox: InlineUIContainer inside a ReadOnlyRange throws StackOverflowException on export to XAML
When trying to export a document containing InlineUIContainer inside a read-only range, the XamlWriter.Save() method that is used in XamlFormatProvider.Serialize() throws StackOverflow exception.

Sample code to reproduce the exception:
InlineUIContainer container = new InlineUIContainer();
Button btn = new Button();
btn.Content = "Sample Button";
btn.Width = 70;
btn.Height = 30;
container.UiElement = btn;

ReadOnlyRangeStart start = new ReadOnlyRangeStart();
ReadOnlyRangeEnd end = new ReadOnlyRangeEnd();
end.PairWithStart(start);
this.rtb.InsertInline(container);
this.rtb.Document.Selection.SelectAll();
this.rtb.InsertAnnotationRange(start, end);

XamlFormatProvider provider = new XamlFormatProvider();

string content = provider.Export(this.rtb.Document);
File.WriteAllText(@"c:\temp\asd.xaml", content);
2 comments
ADMIN
Tanya
Posted on: 04 Apr 2018 14:14
Hi,

Continue following this item so you can receive updates about status changes on it.

Regards,
Tanya
①Dr Mostafa
Posted on: 16 Jan 2018 16:35
I'm suffering from the same problem.