Skip to content
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

What all conditions results in ERROR_INVALID_STATE when sharing same user data folder across two webviews #1213

Closed
santoshsampath opened this issue Apr 23, 2021 · 7 comments
Assignees

Comments

@santoshsampath
Copy link

In the Share User data folders it is mentioned that same options to be provided for ICoreWebView2Environment.

When I was trying out this in two apps, I found that even if we pass same userData folder to CreateCoreWebView2EnvironmentWithOptions, it fails with the same error when we try to create webview using CreateCoreWebview2Controller, if DPI awareness of both apps sharing webview do not match.
I also received same error when trying to use webview in one of existing project. I then created new project similar to "Getting started for C++" and error is not seen.

I wanted to know what are the other variables to look for when sharing webview2 in two apps?
Is there a way to look for diagnostic logs to know what caused CreateCoreWebview2Controller to fail with this error so that I can fix my project settings correctly.

@santoshsampath santoshsampath changed the title What all conditions results in ERROR_INVALID_STATE when sharing same cache data folder across two webviews What all conditions results in ERROR_INVALID_STATE when sharing same user data folder across two webviews Apr 23, 2021
@champnic
Copy link
Member

Hey @santoshsampath - DPI awareness is the most common error of this type. I believe it's any change that would create a different command-line when launching the browser process will run into this issue.

@LiangTheDev Do you know if we have this documented in detail somewhere or an easy way to see when this might occur?

@champnic champnic self-assigned this Apr 27, 2021
@santoshsampath
Copy link
Author

santoshsampath commented Apr 27, 2021

Ok thanks command line is a good hint, will compare them in procmon and find out what I can find

@LiangTheDev
Copy link
Member

Command line is what we really check. So, verify that is a good way.

@santoshsampath
Copy link
Author

It was indeed.

The only difference was --webview-exe-version= was present for one of the app but not other one. It seems to be picking product version from the host binary for this.
I think it probably should be too keen on the versions of webview host. If two processes within an app wants to share, they may/may not have same versions.

But anyway thanks for the hint it was really useful.

@LiangTheDev
Copy link
Member

This is actually a very special case and a bug in WebView2.
We do try to ignore the value of --webview-exe-version switch. If both don't have it, or both has it but with different values, we would allow it. If one has it but the other doesn't have it, our current code would complain. I'll create a bug for this and address it in the future release of the WebView2 runtime.

@LiangTheDev
Copy link
Member

Made a change in WebView2 runtime, will be available in Edge WebView2 Runtime 92 when it is released.

@champnic
Copy link
Member

champnic commented May 5, 2021

This should be fixed in all runtimes 92.0.872.0+. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants