Welcome Guest Search | Active Topics | Sign In | Register

EO WebBrowser 21.0.94 crash when assigning WebView Options
Stefan Koell
Posted: Tuesday, May 4, 2021 8:36:00 AM
Rank: Advanced Member
Groups: Member

Joined: 12/23/2013
Posts: 114
Hi,

the latest version crashes when the WebControl.WebView is assigned. 21.0.85 and earlier work fine.

Here's what I'm doing (last line crashes):
Code: C#
Browser = new WebControl {Dock = DockStyle.Fill};
            SplitContainerBrowser.Panel1.Controls.Add(Browser);
            webEngine = Engine.Create(BrowserEngineId);
            webView = new WebView();
            webView.Engine = webEngine;
            Browser.WebView = webView;


Note: this is simplified code to reproduce the crash. In my code, I also set options on the engine and view...

The following stack trace is presented:
Code: C#
System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. 
 ---> System.Exception: Destroy must be called from the same thread the WebView is created. 
 at EO.WebBrowser.WebView.eojc(Boolean ga) 
 at EO.WebBrowser.WebView.Create(IntPtr hWnd) 
 at EO.WinForm.WebViewHost.lkjc(Object l) 
 --- End of inner exception stack trace --- 
 at System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor, Boolean wrapExceptions) 
 at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture) 
 at System.Delegate.DynamicInvokeImpl(Object[] args) 
 at System.Delegate.DynamicInvoke(Object[] args) 
 at System.Windows.Forms.Control.InvokeMarshaledCallbackDo(ThreadMethodEntry tme) 
 at System.Windows.Forms.Control.InvokeMarshaledCallbackHelper(Object obj) 
 at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state) 
--- End of stack trace from previous location --- 
 at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state) 
 at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state) 
 at System.Windows.Forms.Control.InvokeMarshaledCallback(ThreadMethodEntry tme) 
 at System.Windows.Forms.Control.InvokeMarshaledCallbacks() 
 at System.Windows.Forms.Control.WndProc(Message& m) 
 at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m) 
 at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m) 
 at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, WM msg, IntPtr wparam, IntPtr lparam) 
 at EO.Internal.mihg.yyxt.lyju(IntPtr ofd, Int32 ofe, IntPtr off, IntPtr ofg) 
 at EO.Internal.mihg.yyxt.lyjv(IntPtr ofi, Int32 ofj, IntPtr ofk, IntPtr ofl, IntPtr ofm, IntPtr ofn) 
 at EO.Internal.mihg.ehhi(yyxn& oag) 
 at EO.Internal.mihg.ehia(yyxn& odg) 
 at EO.Internal.mihg.ehhx(Int32 odd) 
 at EO.Internal.miia`3.erff.atjk(Int32 oof, micj oog, Int32 ooh) 
 at EO.Internal.miia`3.cjhw(k one, miem onf, Boolean ong, Int32 onh) 
 at EO.Internal.miia`3.cjhw(k oni, miem onj, Boolean onk) 
 at EO.Internal.miia`3.cjhw(k onl, Boolean onm) 
 at EO.Internal.jobj.ypvp() 
 at EO.Internal.jobj.lfxf.yudy() 
 at EO.Internal.mibz.vflo(Action ltw) 
 at EO.Internal.jobj.tglg(WindowsIdentity fg) 
 at EO.WebEngine.Engine.Start(WindowsIdentity user) 
 at EO.WebEngine.Engine.Start() 
 at EO.Internal.jobj.ypvo() 
 at EO.Internal.hfnn..ctor(WebView p) 
 at EO.WebBrowser.WebView.ypgf() 
 at EO.WebBrowser.WebView.ypgf(IntPtr fp, Boolean fq) 
 at EO.WebBrowser.WebView.Create(IntPtr hWnd) 
 at EO.WinForm.WebViewHost.hftk.set_qeic(WebView value) 
 at EO.WinForm.WebControl.set_WebView(WebView value)


I also verified that the code is executed on the main thread/UI thread.

Regards,
Stefan
eo_support
Posted: Tuesday, May 4, 2021 11:40:50 AM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,066
Hi,

Can you send a test project to us? This is an apparent re-entering issue (WebView.Create is being called again from inside WebView.Create). However we are not able to construct a test case to recreate this test flow even with your test code. We could fix it without such a test case but we would certainly prefer to be able to reproduce the exact call stack you have to make sure that we fix it thoroughly.

Thanks!
Stefan Koell
Posted: Tuesday, May 4, 2021 11:49:19 AM
Rank: Advanced Member
Groups: Member

Joined: 12/23/2013
Posts: 114
The problem is that I can't reproduce it in another project. I tried that already. My app is quite complex and I'm not sure what trips it off. All I know is that the way I assigned the web view worked for years and stopped working with the last version. Anything else I can do to help out?
eo_support
Posted: Tuesday, May 4, 2021 1:53:31 PM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,066
Can you post the stack trace below set_WebView call?
Stefan Koell
Posted: Tuesday, May 4, 2021 2:12:17 PM
Rank: Advanced Member
Groups: Member

Joined: 12/23/2013
Posts: 114
Sure:

Code: C#
System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. 
 ---> System.Exception: Destroy must be called from the same thread the WebView is created. 
 at EO.WebBrowser.WebView.eojc(Boolean ga) 
 at EO.WebBrowser.WebView.Create(IntPtr hWnd) 
 at EO.WinForm.WebViewHost.lkjc(Object l) 
 --- End of inner exception stack trace --- 
 at System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor, Boolean wrapExceptions) 
 at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture) 
 at System.Delegate.DynamicInvokeImpl(Object[] args) 
 at System.Delegate.DynamicInvoke(Object[] args) 
 at System.Windows.Forms.Control.InvokeMarshaledCallbackDo(ThreadMethodEntry tme) 
 at System.Windows.Forms.Control.InvokeMarshaledCallbackHelper(Object obj) 
 at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state) 
--- End of stack trace from previous location --- 
 at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state) 
 at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state) 
 at System.Windows.Forms.Control.InvokeMarshaledCallback(ThreadMethodEntry tme) 
 at System.Windows.Forms.Control.InvokeMarshaledCallbacks() 
 at System.Windows.Forms.Control.WndProc(Message& m) 
 at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m) 
 at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m) 
 at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, WM msg, IntPtr wparam, IntPtr lparam) 
 at EO.Internal.mihg.yyxt.lyju(IntPtr ofd, Int32 ofe, IntPtr off, IntPtr ofg) 
 at EO.Internal.mihg.yyxt.lyjv(IntPtr ofi, Int32 ofj, IntPtr ofk, IntPtr ofl, IntPtr ofm, IntPtr ofn) 
 at EO.Internal.mihg.ehhi(yyxn& oag) 
 at EO.Internal.mihg.ehia(yyxn& odg) 
 at EO.Internal.mihg.ehhx(Int32 odd) 
 at EO.Internal.miia`3.erff.atjk(Int32 oof, micj oog, Int32 ooh) 
 at EO.Internal.miia`3.cjhw(k one, miem onf, Boolean ong, Int32 onh) 
 at EO.Internal.miia`3.cjhw(k oni, miem onj, Boolean onk) 
 at EO.Internal.miia`3.cjhw(k onl, Boolean onm) 
 at EO.Internal.jobj.ypvp() 
 at EO.Internal.jobj.lfxf.yudy() 
 at EO.Internal.mibz.vflo(Action ltw) 
 at EO.Internal.jobj.tglg(WindowsIdentity fg) 
 at EO.WebEngine.Engine.Start(WindowsIdentity user) 
 at EO.WebEngine.Engine.Start() 
 at EO.Internal.jobj.ypvo() 
 at EO.Internal.hfnn..ctor(WebView p) 
 at EO.WebBrowser.WebView.ypgf() 
 at EO.WebBrowser.WebView.ypgf(IntPtr fp, Boolean fq) 
 at EO.WebBrowser.WebView.Create(IntPtr hWnd) 
 at EO.WinForm.WebViewHost.hftk.set_qeic(WebView value) 
 at EO.WinForm.WebControl.set_WebView(WebView value) 
 at RoyalTS.Plugins.Connections.WebPageChrome.UI.ChromeBrowserControl.Initialize(Control host, WebView webView) in C:\Users\stefankoell\source\repos\Royal Applications\RoyalTS\Windows\RoyalTS.Application\Plugins\Connections\WebPageChrome\UI\ChromeBrowserControl.cs:line 483 
 at RoyalTS.Plugins.Connections.WebPageChrome.WebPageChromeConnection.CreateClientControl() in C:\Users\stefankoell\source\repos\Royal Applications\RoyalTS\Windows\RoyalTS.Application\Plugins\Connections\WebPageChrome\WebPageChromeConnection.cs:line 538 
 at RoyalTS.Plugins.Connections.WebPageChrome.WebPageChromeConnection.<>c__DisplayClass30_0.b__0() in C:\Users\stefankoell\source\repos\Royal Applications\RoyalTS\Windows\RoyalTS.Application\Plugins\Connections\WebPageChrome\WebPageChromeConnection.cs:line 236
eo_support
Posted: Tuesday, May 4, 2021 2:15:23 PM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,066
We are mostly interested in how it got to this stack trace. So if possible please provide the entire stack trace all to the bottom. You can email it to us if you prefer not to post it publicly in the forum. See here for our email address:

https://www.essentialobjects.com/forum/test_project.aspx
Stefan Koell
Posted: Tuesday, May 4, 2021 2:17:47 PM
Rank: Advanced Member
Groups: Member

Joined: 12/23/2013
Posts: 114
I'm not sure I understand. The stack trace I posted is the complete stack trace from the caught exception. Do you need something different?
eo_support
Posted: Tuesday, May 4, 2021 3:10:19 PM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,066
Hi,

We were able to reproduce the issue have found the root of the problem. We should be able to post a new build with the fix later this week.

Thanks!
Stefan Koell
Posted: Wednesday, May 5, 2021 4:09:41 AM
Rank: Advanced Member
Groups: Member

Joined: 12/23/2013
Posts: 114
That's great news. I know it can be hard to track bugs without a good repro case, so thanks for looking into it. Looking forward to the next release.

Regards,
Stefan
eo_support
Posted: Thursday, May 6, 2021 1:05:52 PM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,066
Thanks for understanding. We have just posted a new build that should resolve this issue. Please download it from our download page and let us know how it goes.
Stefan Koell
Posted: Friday, May 7, 2021 3:03:34 AM
Rank: Advanced Member
Groups: Member

Joined: 12/23/2013
Posts: 114
Thanks for the quick fix! I can confirm, all is working again...
eo_support
Posted: Friday, May 7, 2021 1:40:11 PM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,066
Great. Thanks for confirming the fix!
BenjaminSimpson1989
Posted: Tuesday, June 28, 2022 7:43:31 PM
Rank: Advanced Member
Groups: Member

Joined: 1/12/2015
Posts: 81
I'm also occasionally getting this same exception:
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
eo_support
Posted: Wednesday, June 29, 2022 2:56:36 PM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,066
Hi BenjaminSimpson1989,

Please repost your question in a new thread. Your question is completely unrelated to the original question of this thread.

Thanks!


You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.