Microsoft Technologies based on the .NET software framework. Miscellaneous topics that do not fit into specific categories.
WebView2 stops working after 2 - 3 days with HRESULT 0x8007139F in WinForms application
We have a VB.NET WinForms application that uses five WebView2 controls on the same form.
A client is experiencing the following problem:
- WebView2 works normally for approximately 2–3 days.
- After that, the application only shows the loading state and the WebView does not start.
- Replacing the WebView2 runtime makes the application work again temporarily.
- After another 2–3 days, the same problem returns.
- This happens with both the old and new runtime versions.
Runtime versions tested:
Old runtime: 123.0.2420.53_x64
New runtime: 147.0.3912.98_x64
Error:
The group or resource is not in the correct state to perform the requested operation.
(Exception from HRESULT: 0x8007139F)
The application targets .NET Framework and runs as an x86 process. It uses a fixed-version WebView2 runtime and a custom user-data folder under the current user’s local application data:
%LOCALAPPDATA%\runtime_browser 2.0
The application creates a WebView2 environment and uses it to initialize five controls:
Dim environmentOptions As New CoreWebView2EnvironmentOptions()
environmentOptions.AdditionalBrowserArguments = "--disable-web-security"
Dim webViewEnvironment =
Await CoreWebView2Environment.CreateAsync(
fixedVersionFolderPath,
userDataFolder,
environmentOptions)
Await WebView1.EnsureCoreWebView2Async(webViewEnvironment)
Await WebView2.EnsureCoreWebView2Async(webViewEnvironment)
Await WebView3.EnsureCoreWebView2Async(webViewEnvironment)
Await WebView4.EnsureCoreWebView2Async(webViewEnvironment)
Await WebView5.EnsureCoreWebView2Async(webViewEnvironment)
The form is reused across multiple dialog runs. WebView2 initialization is started from an Async Sub method, and the application may create a new environment on subsequent form loads while the same user-data folder is reused. Form closing does not currently wait for pending initialization to finish before the form lifecycle ends.
Environment creation succeeds, but WebView2 initialization eventually fails while creating the controller. The failure occurs before navigation or website code executes. Replacing the runtime does not provide a permanent solution; it only allows WebView2 to work for another few days.
Questions
- What are the most likely causes of
0x8007139FwhenEnsureCoreWebView2Asyncfails during controller creation after the application has been running for several days? - What is the recommended solution to fix this problem and prevent the error from recurring?