New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
I'm working on WPF application that there are custom UI Threads. When I started WebView2, why the UI Threads replaced by Edge sub-processes? #520
Comments
Hi @aesteves900, thanks for the report! If I'm understanding correctly from the screenshots, those are processes that are being created, not threads. And they aren't all displaying UI. WebView will create and use multiple processes for various aspects of it's execution, including main browser process, GPU process, and renderer processes per site. You can read more about it here: I wouldn't expect it to "replace" or close any of the existing processes though. Is that what you are seeing? If possible, can you share some sample code/app that demonstrates this? |
Hello, @champnic! Thank you for answer my question! I created the Thread according to Microsoft documentation like this: using NativeWindow = System.Windows.Window; Thread newWindowThread = new Thread(() =>
private NativeWindow CreateWindow(string componentTitle)
My UI Thread uses minimal resources of System.Windows.Window, like you, see above. This code creates a WPF UI Thread and receives out-of-process all of PropertyChangeEvents from ViewModel. This solution allows thousands of UI updates in seconds. When I started the WebView2 via CoreWebView2Environment.CreateAsync...causes the effect that I showed up on screenshot 2. Is it possible to start the msedgewebview2.exe as a background process via CoreWebView2Environment.CreateAsyn without any change on the Main Process on the Task Manager? Just to let you all know the CefSharp create creates a BrowserSubProcess that's receive render actions and allows you to customize and extend the default implementation: My console example from CefSharp. It running out-of-process from the Main WPF Application. Shows in the task manager as above. |
Thanks for the additional info! Our process model is based on Edge/Chromium's, and matches the sandboxing model described in CEF: https://bitbucket.org/chromiumembedded/cef/wiki/SandboxSetup.md#:~:text=The%20Chromium%2FCEF%20multi-process%20model%20uses%20separate%20processes%20for,access%20to%20the%20file%20system%20or%20network%20stack. Are there specific concerns or problems you are running into with the current process model? |
Closing old issue. Please let me know if we need to re-open this for any reason. Thanks! |
Description
I'm working on WPF application that there are custom UI Threads. When I started WebView2, why the UI Threads replaced by Edge sub-processes?
It's a Trade application (WPF-Xamarin, .NET Core 3.1) that has intensive UI updates. There are two components that need to use WebView. We using CefSharp and a custom BrowserSubprocess to avoid this replacement. But we need to use a WebView from a big player like Microsoft because there are concise updates and continuation of the WebView product.
In the Login process, we use a WebView in a Custom Renderer:
This code above works perfectly but replaces all custom UI Threads. Please take a look at the screencaps.
Version
SDK: e.g. 0.9.628-prerelease
Runtime Browser channel and version, e.g. Canary Beta
Framework: WPF, .NET Core 3.1, Xamarin 4.7.0.1179.
OS: Win10, Enterprise
Repro Steps
Screenshots
1 - Open the application, there re 3 UI Threads, the first is Mainwindow and two custom threads.
2 - After opening a WebView and just navigate to Login URL, all the UI Threads will be reconfigured, why?
The core:
var core = await CoreWebView2Environment.CreateAsync();
var control = new WebView2();
control.Source = new Uri(url);
base.SetNativeControl(control);
The text was updated successfully, but these errors were encountered: