Issues with the UserDataFolder property for Webview2

1.2k views Asked by At

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:

  • Why is it creating an empty folder with name "myexe.WebView2" in default location, when I am passing "userDataFolder"?
  • What should I do to avoid that?

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.

1

There are 1 answers

0
David Risney On BEST ANSWER

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!