1 Attachment(s)
ContextSwitchDeadlock Error
I get the ContextSwitchDeadlock Error when I set try to RichTextBox text to some large text, empty it and then set it to some other large text again.
This is what I'm doing:
1. RichTextBox1.Text = SomeLargeString
2. RichTextBox1.Text = EmptyString
3. (do some other stuff here)
4. RichTextBox1.Text = SomeOtherLargeString
The SomeOtherLargeString is smaller than SomeLargeString, but error occurs on that line.
Anyone has any ideas about this?
Re: ContextSwitchDeadlock Error
What happens if you remove step 3? Do you still get the same error?
Re: ContextSwitchDeadlock Error
The immediate previous line to step 4 works successfully. It is actually a function call that outputs the SomeOtherLargeString. Then the yellow marker comes to line in step 4. When I press F10 there it takes a long time and finally shows this error.
Re: ContextSwitchDeadlock Error
What happens if you remove step 3? Do you still get the same error?
Re: ContextSwitchDeadlock Error
Quote:
Originally Posted by
jmcilhinney
What happens if you remove step 3? Do you still get the same error?
That's surprising!
It works ok if I remove that step.
Actually what I'm doing there is - load the current richtextbox text into a webbrowser control. Then process that data and finally put the processed result back into richtextbox. The data is html type and the process basically transposes some tables etc. in it.
Code:
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
WebBrowser1.BringToFront()
WebBrowser1.DocumentText = RichTextBox1.Text
RichTextBox1.Text = ""
EnsureWebBrowserIsReady()
Dim result As String = "<TABLE>" & ProcessStage2() & "</TABLE>"
RichTextBox1.Text = result
RichTextBox1.BringToFront()
End Sub