We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

Load() for empty Text hangs

Hi,

I am encountering a strange problem with SfRichTextBoxAdv: I do update the RichTextBox Content according to the MVVM sample with LoadStream().

I do reuse the control an a WPF page and load the contents like this:

            using (Stream stream = new MemoryStream())
            {
                byte[] bytes = Encoding.UTF8.GetBytes(text); // Convert the text string to byte array.

                stream.Write(bytes, 0, bytes.Length); // Writes the byte array to stream.
                stream.Position = 0;

                Load(stream, format); // Load the stream
            }

Sometimes on a successive Load() with an empty (!) string the application hangs and times out with the following error:

Assistent für verwaltetes Debuggen "ContextSwitchDeadlock"  ist aufgetreten.
  HResult=0x00000000
  Nachricht = **Assistent für verwaltetes Debuggen "ContextSwitchDeadlock" :** "The CLR has been unable to transition from COM context 0xbf268170 to COM context 0xbf268048 for 60 seconds. The thread that owns the destination context/apartment is most likely either doing a non pumping wait or processing a very long running operation without pumping Windows messages. This situation generally has a negative performance impact and may even lead to the application becoming non responsive or memory usage accumulating continually over time. To avoid this problem, all single threaded apartment (STA) threads should use pumping wait primitives (such as CoWaitForMultipleHandles) and routinely pump messages during long running operations."

Any ideas what causes this issue?

And is there anothe way to completely clear the SfRichTextBoxAdv Contents other thal Loading an empty Document? There is no Clear() function.

Regards
Bernd




5 Replies

VM Venkatesan Mani Syncfusion Team December 14, 2016 05:45 AM UTC

Hi Bernd,

Thank you for contacting Syncfusion support.

You can clear the contents of SfRichTextBoxAdv control by executing “NewDocumentCommand”. Please find the sample code in following table.
 
SfRichTextBoxAdv.NewDocumentCommand.Execute(null, richTextBoxAdv); 
 
Please try this sample code and let us know if this helps you.

 
Regards,
Venkatesan M. 



BE Bernd December 14, 2016 08:27 AM UTC

Hi Venkatesan,

thank you for your hint with NewDocumentCommand . This way I can bypass the problem.

But the question remains if it is a bug in Load() for an empty stream or if I am doing something wrong?

However my app does not hang anymore. :-) So feel free to close this issue.

Regards
Bernd


VM Venkatesan Mani Syncfusion Team December 15, 2016 06:10 AM UTC

Hi Bernd,

Thank you for your update.

We are glad to know that your issue has been resolved with the solution provided. We are unable to reproduce the issue reported in the previous update. The empty strings/streams are loaded properly in our SfRichTextBoxAdv control with the latest version 14.4.0.15. Could you please let us know which version your using?

Regards,
Venkatesan M. 



BE Bernd December 15, 2016 08:45 AM UTC

Hi Venkatesan,

I am using the latest version (v14.4.0.15).

The problem occurs, when I load am empty string more than once. Meanwhile the view using the control is hidden and shown again.

There may also be a problem in my code, I cannot rule that out. Does the error message give you any hint?

Regards
Bernd


VM Venkatesan Mani Syncfusion Team December 16, 2016 05:55 AM UTC

Hi Bernd,

Thank you for your update.

We are afraid that we are not able to reproduce the reported issue with the latest version of SfRichTextBoxAdv control Could you please share us the simple sample to reproduce this issue or the code handled in SfRichTextBoxAdv extension class and property binding? So, that we can investigate further and provide you the appropriate solution at the earlier.

Regards,
Venkatesan M.


Loader.
Live Chat Icon For mobile
Up arrow icon