DpiAware and DpiUnaware webView2 instance sharing userDataFolder -> Exception: The group or resource is not in the correct state to perform the requested operation #899
Labels
bug
Something isn't working
We have multiple applications with WebView2 instances across different processes, sharing the same userDataFolder.
Sometimes i got an System.Runtime.InteropServices.COMException while initalizing WebView2 while another one is runing:
"The group or resource is not in the correct state to perform the requested operation"
ExceptionSource:
Microsoft.Web.WebView2.Core.dll!Microsoft.Web.WebView2.Core.CoreWebView2Environment.CreateCoreWebView2ControllerAsync(System.IntPtr ParentWindow) Unknown
The environment options, WebView2 versions on all instances are exactly the same.
After hours of debugging I finally figured out what the problem is:
One winforms process is declared as dpiAware in the App.config, the other is not.
This seems to lead to different WebView2Environments, causing the second initialization to crash.
Version
Happens in newest SDK (including prerelease) and up to date runtime.
Framework: WinForms
OS: Windows 10
Repro Steps
--> Second App will not be able to initalize WebView2
App.config code snippet
<System.Windows.Forms.ApplicationConfigurationSection> <add key="DpiAwareness" value="true"/> </System.Windows.Forms.ApplicationConfigurationSection>
Final words
Maybe this problem is not solvable because the environment just is different. But there should be at least an exception telling me the problem and the documentation has to be updated.
Thanks! :-)
The text was updated successfully, but these errors were encountered: