question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Question: WebView2 requires elevated mode ?

See original GitHub issue

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?

image

Issue Analytics

  • State:open
  • Created a year ago
  • Comments:21 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
krschaucommented, Jun 10, 2022

@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.

0reactions
lyahdavcommented, Jul 28, 2023

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 WEBVIEW2_USER_DATA_FOLDER environment variable.

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to fix msedgewebview2 error in VS2022 when admin?
My best solution so far is to create a shared folder. I decided to make C:\Users\<administrator_user>\AppData\Local\Temp\VSWebView2Cache\ ...
Read more >
What Is Microsoft Edge WebView2 Runtime & How to Fix Its ...
# 1. Disable the WebView2 from Task Manager · # 2. Uninstall Microsoft Edge WebView2 Runtime in Silent Mode · # 3. Use...
Read more >
Microsoft Edge Webview2 Runtime is a huge problem
Just run this in Powershell (elevated as Admin):winget uninstall "Microsoft Edge WebView2 Runtime". If you want to install it again, ...
Read more >
Distribute your app and the WebView2 Runtime
The WebView2 Runtime is a redistributable runtime and serves as the underlying (or backing) web platform for WebView2 apps.
Read more >
Visual Studio Windows WebView2 installation error
Go to C:\ProgramData\Microsoft\VisualStudio\Packages , check if a similar or the same package(folder) partly called WebView2 exists. Open it and ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found