Approved
Last Updated: 31 Oct 2018 08:13 by ADMIN
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);
(Total attached files size should be smaller than 20mb. Allowed extensions: .zip, .rar, .jpg, .png, .gif)
2 comments
①Dr Mostafa
Posted on: 16 Jan 2018 16:35
I'm suffering from the same problem.
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