Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
130
Getting a weird ContextSwitchDeadlock after I paste in large amounts of HTML to the RichTExtEditor
posted

I have a XamRichTextEditor that I am using and I have recently gotten some weird errors when trying to manually refresh the value of my HtmlDocumentAdapter manually. I want my HtmlDocumentAdapter.Value to be equivalent to a custom Dependency Property on my custom control (that utilizes the XamRichTextEditor and HtmlDocumentAdapter, amoung other things). 

The code fires in the XamRichTextEditor.Document.ContentChanged event. Here is some example code:

private void Document_ContentChanged(Object sender, DocumentContentChangedEventArgs e)
{
if (!this.htmlLostFocusTrigger && this.htmlAdapter != null)
{
try
{
this.htmlAdapter.RefreshValue();
this.Html = this.htmlAdapter.Value;
this.htmlExp.UpdateSource();
}
catch { }
}
}

When this.Html = this.htmlAdapter.Value; fires I get a weird exception and my UI completely blocks and freezes. After waiting a while I get a ContextSwitchDeadlock exception.

Note, this happens after I paste html then try to add some new content to the editor. Something is breaking. If I remove that line all seems to be fixed, but then my bindings work improperly.

Attached is the html I am pasting, my CS file, and my XAML theme for my custom control. 

Examples.zip
Parents Reply Children
No Data