Closed njannink closed 1 year ago
Maybe it has to do something with a listener port? Is there a way to configurate the port being used to listen to the WebView2 messages?
@njannink Ensure that you are disposing the WebView2 control by calling "Dispose()". The issue may be that you are closing the form containing a WebView2 control without calling Dispose(). If you use ShowDialog
to open your form containing your WebView2 control, you need to call Dispose()
(perhaps in Form_Closing
) or your application will throw an exception.
ShowDialog (Shows the form as a modal dialog box) - no other action can be performed until the form (window) is closed
Because a form displayed as a dialog box is hidden instead of closed, you must call the Dispose method of the form when the form is no longer needed by your application.
Show (Display a non-modal form)
The control is displayed in a dockable pane. So its actually not closed or displayed as model form
If you try not initializing the WebView2 control (keep the rest of your current code the same), does CefSharp still fail?
Then my WebView2 control gives an exception, because it tries to write the WebView cache to the Program Files folder where the app is installed. I use this init code to make sure the correct path is set:
var environment = await CoreWebView2Environment.CreateAsync(userDataFolder: CacheFolder);
await WebView.EnsureCoreWebView2Async(environment);
Makes sense - are you setting the Source property? (That also causes initialization, which could be causing the error you see)
I'm only asking for these tests to try and isolate whether it's something colliding with CefSharp and WebView2, or if perhaps something else got changed when you added WebView2 to your project that could have disrupted your CefSharp usage.
I'm not setting the source property before the WebView is initialized EnsureCoreWebView2Async(env)
.
When I don't open the pane with the WebView2 control I can still open forms and panes with CefSharp controls on them. But after I opened the pane with the WebView2 control then opening any new view/pane with a CefSharp control causes a crash of the main app.
I got lucky.
We just got a new release of the main app and that release has an updated version of CefSharp. With that version the crash is gone.
Crashing CefSharp version: 65.0.0.0 Ok CefSharp version: 83.4.20.0
So for sure one of the old CefSharp chromium assemblies was clashing with the WebView2 runtime, which is I beleave also chromium.
For me this issue can be closed, but maybe the WebView2 team wants to investigate this further?
I'm interested in this. We link to both CEFSharp and WebView2, although we should only ever run or the other. But if there are some shared libraries and WebView2 updates automatically we could develop a conflict at a later time. Updating cef may only have postponed the problem
That is true. Might be good to figure out how to isolate WebView2 completely from potential other dll's. Might be even a security risk I don't know
Microsoft team, We have same issue in our APP. we have Custom WPF control derived from cef v57 and newly added Win32 native control utilized in our APP. we are seeing crash while we are invoking WPF based cef control .
Any specific suggestion?
Hello, I've encoutered same issues in a mashup application with the Dataviz app Spotfire from Tibco : When trying to display webview2 in the Spotfire context (which use xilium cefglue, it crashes all new instance of document in it). Didn't find any workaround on it for now, except keep on the old WebBrowser control ....
Hello Gabriel, We have resolved this issue by upgrading CEF v.84.4.10 . That has solved our issue.
Thanks, Rajan
In my case this is not possible as the application is a third party one, and upgrading cef on which it works is not possible
Same issue here.
Closing old issues. Let me know if this is still an issue and I can re-open.
Closing old issues. Let me know if this is still an issue and I can re-open.
This issue still occurs. After using WebView2 to open a web browser successfully, attempting to open a web browser with CEF results in an internal crash in libcef.dll. This problem occurs 100% of the time in older versions of CEF, regardless of the version of WebView2.
When a crash occurs, the cef3.log file logs the following message:
"FATAL: hwnd_util.cc(65): Invalid window handle (0x578)."
Hi @Hoya-Lee , Can we document the steps to re-produce with Version of CEF and webview2 used in application?
we need had solved this issue earlier by aligning the suggested version of CEF and webview2 by Microsoft. Note : we had also seen some occurrences of "internal crash in libcef.dll" in our application. We are curious to learn this more.
-Rajan
Description My situation: we build plugins for an existing application and because this app is shipped with a very old version of CefSharp we are not able to use modern web technologies in the CefSharp browser. To work around this issue we use WebView2 in the plugins we create to display for example a Blazor website. The issue that now arises is that the main app crashes when a view or form with CefSharp is opened. So it looks like that there are some unmanaged dll issues or something.
When attaching the debugger I'm not able to catch any exception. Even with catch all exceptions enabled.
Anybody has any idea what I possibly could do? And or is there some way to isolate the WebView2 in for example a seperate AppDomain?
Version SDK: 1.0.664.37 Runtime: 87.0.664.55 (64-bit) Framework: WPF OS: Win10