Rank: Advanced Member Groups: Member
Joined: 1/12/2015 Posts: 81
|
I'm occasionally getting this exception on version 22.1.13.0: Quote:Exception: System.Exception: Destroy must be called from the same thread the WebView is created. at EO.WebBrowser.WebView.lqid(Boolean fq) at EO.WebBrowser.WebView.Create(IntPtr hWnd) Here's my code:
Code: Visual Basic.NET
Private Sub ChangeProxy()
webView.Destroy()
webView.Engine.Stop(False) 'this line is needed so it shuts down eowp.exe but doesn't delete the cache folder
webView.Engine = EO.WebEngine.Engine.Create("WE")
webView.Engine.Options.CachePath = CachePath
webView.Engine.Options.Proxy = New EO.Base.ProxyInfo(EO.Base.ProxyType.HTTP, "127.0.0.1", 8888, "", "")
CreateWebViewWithHandle(pbWebControl.Handle)
webView.DoEvents()
End Sub
Private Sub CreateWebViewWithHandle(handle As IntPtr)
pbWebControl.Parent.BeginInvoke(
Sub()
Dim intAttempts = 0
While True
Try
webView.Create(handle)
Exit Sub
Catch ex As Exception
intAttempts = intAttempts + 1
If intAttempts >= 20 Then
Throw
Else
Threading.Thread.Sleep(3000)
End If
End Try
End While
End Sub
)
End Sub
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,217
|
You will receive this error if the WebView was created in one thread and you try to destroy it in a different thread (triggered by Create). Obviously the code you posted does not show such multi-thread issue. So we are not able to tell much from the code you posted. However if you can send a test project over we will be happy to debug it here.
|