MicrosoftEdge / MicrosoftEdge/WebView2Feedback
The CacheFolder is locked by msedgewebview2.exe and cannot be deleted even when the app is closed.
@dianaqu is already working on this.
Since Dec 13, 2024.
- Dominant language
- PowerShell
- Stars
- 526
- Forks
- 67
- PR merge metrics
- No merged PRs in 30d
Description
What happened?
Once you register a browser extension with AddBrowserExtensionAsync, the CacheFolder is locked by msedgewebview2.exe and cannot be deleted even when the app is closed.
environment
Microsoft Visual Studio Community 2022 (64 bit) - Preview
Version 17.13.0 Preview 2.0
-
cacheFolderPath 「%temp%\WebView2Cache」
-
「Microsoft Visual Studio 2022」closed.
-
「%temp%\WebView2Cache」Folder deletion failed.
-
Search for "WebView2Cache" in resmon.exe
The results are as follows:
-
Upon checking, I found that 「%temp%\WebView2Cache」 was not terminated and remained locked by "msedgewebview2.exe".
-
During debugging, "msedgewebview2.exe" does not terminate 「%userprofile%\AppData\Local\Microsoft\VisualStudio\Webview2Cache」.
-
The folder can be deleted by terminating the "msedgewebview2.exe" process.
However, there is still a problem with unnecessary processes remaining.
Importance
Important. My app's user experience is significantly compromised.
Runtime Channel
Stable release (WebView2 Runtime)
Runtime Version
131.0.2903.86
SDK Version
1.0.2903.40
Framework
Winforms
Operating System
Windows 11
OS Version
24H2 26100.2454
Repro steps
code
using Microsoft.Web.WebView2.Core;
using System;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace WebView2_TEST_C_
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private async Task InitializeAsync()
{
WebView2.CoreWebView2InitializationCompleted += WebView2_CoreWebView2InitializationCompleted;
string cacheFolderPath = @"<%temp%>\WebView2Cache";
options.AreBrowserExtensionsEnabled = true;
CoreWebView2Environment environment = await CoreWebView2Environment.CreateAsync(null, cacheFolderPath, options);
await WebView2.EnsureCoreWebView2Async(environment);
}
private async void Form1_Load(object sender, EventArgs e)
{
await InitializeAsync();
}
private async void WebView2_CoreWebView2InitializationCompleted(object sender, Microsoft.Web.WebView2.Core.CoreWebView2InitializationCompletedEventArgs e)
{
// Operation confirmed on edge
var path = @"<%userprofile%>AppData\Local\Microsoft\Edge\User Data\Default\Extensions\xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx\1.0.0.0_0";
var extension = await WebView2.CoreWebView2.Profile.AddBrowserExtensionAsync(path);
}
}
}
Repros in Edge Browser
No, issue does not reproduce in the corresponding Edge version
Regression
Don't know
Last working version (if regression)
No response
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.