c++webview2

Issues with the UserDataFolder property for Webview2


In my application, I am creating Edge environment using CreateCoreWebView2EnvironmentWithDetails. Right now it is creating a folder next to my exe as "myexe.WebView2", which I don't want. So I am passing "C:\\Users\\username>\\AppData\\Local\\MicrosoftEdge as an UserDataFolder. But still it is creating an empty folder "Myexe.webview2" in my application folder.

Here is sample to show how I am passing arguments.

HRESULT hr = CreateCoreWebView2EnvironmentWithDetails(folderName, L"C:\\Users\\<myUSer>\\AppData\\Local\\MicrosoftEdge",  NULL,     Callback<ICoreWebView2CreateCoreWebView2EnvironmentCompletedHandler>

I knew that edge creates a folder in app local folder as an default location when NULL is passed for UserDataFolder. But here I am giving location for UserDataFolder.

So the questions are:

Update: We have been using this version for a while. Upgrading to latest version will be done in future. For now, the code uses CreateCoreWebView2EnvironmentWithDetails.


Solution

  • What you describe is a bug. If you still see this behavior with the latest SDK, please open an issue against our WebView2 feedback GitHub repo and we can look into it. Thanks!