-
Notifications
You must be signed in to change notification settings - Fork 672
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
Question: WebView2 requires elevated mode ? #7190
Comments
Logged in as local administrator to windows but VS wasn't running as administrator. |
EnsureCoreWebView2Async seems to throw 0x80070005 when it can't create a user data folder. Reference: |
In the WebView2 Win32 C ++ API, you can specify the path of the user data folder with the environment variable "WEBVIEW2_USER_DATA_FOLDER". My app written in C++/WinRT and WinUI3 was able to specify a user data folder by calling the SetEnvironmentVariable function.
However, as I reported in #7201, my app worked fine on Windows App SDK 1.0.3, but no longer works on machines with Windows App SDK 1.1.0 installed. |
Cool, I am glad you succeeded to run the control . Yeah it smells a bit since in line 49 just attempted to invoke a default ctor. This param isn't necessary in your case. |
@sigmarsson Creating custom environment options is not currently supported in WinUI. When you do need to specify a custom User Data Foder, @osamu-ikawa's suggestion of using the environment variable would be the way to do so at this point. Doing it directly via environment options is something we want to support in the future. About the original issue: the Access Denied error is expected when you use a WebView2 inside a WinUI 3 unpackaged app. This is because the default location of the User Data Folder ends up being in a protected directory, and we can't create the folder there. Generally you'll want to handle the user data folder location and cleanup for this type of app. More details and guidance can be found in the Manage user data folders doc. Looks like we need to add a section to the "WinUI 3" tabs to give guidance for unpackaged apps -- I think it would look a lot like what's currently in the "Win32" tabs. I opened an issue to update the doc. |
@krschau However, after installing Windows App SDK 1.1.0, it stopped working properly. I expect the custom data folder settings using environment variables to work even after installing Windows App SDK 1.1.X. |
I get Access Denied on :
So, if I copy Microsoft.Web.WebView2.Core.dll in my app directory, it works. |
@krschau Probably "unpackaged" scenario shall be the default one everywhere, everytime, since we all package after the product is done or at least RC. 1.1.2 ? |
@krschau Which version can we expect the hotfix will ship and when ? |
I can't reproduce the error -- I can use the environment variable to set a custom user data folder with no elevation using WinAppSDK 1.1.0. I too am logged in as admin, but not running VS in admin mode, although I agree with @HypsyNZ that it's probably a permissions thing, not elevation. @sigmarsson I am seeing issues when I wait for EnsureCoreWebView2Async() as you did above, with Similarly, @castorix, could there be an issue with LoadLibraryExW? Are you saying the exception hit when you added that, or it was part of the call stack when you were debugging WebView2 creation? |
It is the error I saw by debugging : it could not load Microsoft.Web.WebView2.Core.dll with Access Denied error |
Any progress on this issue? In my unpackaged app, I get the 0x80070005 (Access denied) error when calling cookie manager API like below.
The 0x80070005 error happens with following backtrace.
The issue happens only when I use WinAppSDK 1.1.x and doesn't happen when I use WinAppSDK 1.0.x. |
I just tried to repro this in an unpackaged WinUI 3 app using the latest WinAppSDK 1.2.221109.1 and setting the |
Package jor app with the template studio to get all this immediate running. Unpackaged application supported but with a pinch of salt merely. Not worth spending the time . |
This issue is stale because it has been open 180 days with no activity. Remove stale label or comment or this will be closed in 5 days. |
Per my previous comment this still seems to be an issue even when setting the |
Attempted to create and initialize
WebView2
but Access Denied. This code is supposed to work only in elevated mode or a particular Windows policy required?The text was updated successfully, but these errors were encountered: