Unhandled exception in BotLab client v2024-01-04 - WebView2

Hello. When I try to install the program I get a white screen in the client and then an error message. About 2 weeks ago I installed and tried the ore mining script, everything worked. I tried to install the program on different versions of Windows, the error was the same everywhere. I don’t know what to do.

Unhandled exception in BotLab client v2024-01-04

System.AggregateException: A Task’s exception(s) were not observed either by Waiting on the Task or accessing its Exception property. As a result, the unobserved exception was rethrown by the finalizer thread. (Couldn’t find a compatible Webview2 Runtime installation to host WebViews.)

—> Microsoft.Web.WebView2.Core.WebView2RuntimeNotFoundException: Couldn’t find a compatible Webview2 Runtime installation to host WebViews.

—> System.IO.FileNotFoundException: The system cannot find the file specified. (0x80070002)

— End of inner exception stack trace —

at Microsoft.Web.WebView2.Core.CoreWebView2Environment.CreateAsync(String browserExecutableFolder, String userDataFolder, CoreWebView2EnvironmentOptions options)

at Microsoft.Web.WebView2.Wpf.WebView2.<>c__DisplayClass33_0.<g__Init|0>d.MoveNext()

— End of inner exception stack trace —


1 Like

Sorry for the delay.

In this case, the fastest way to fix it is to install a software called ‘WebView2’ from Microsoft manually.

To install or update the WebView2 Runtime:

  1. Go to page https://developer.microsoft.com/en-us/microsoft-edge/webview2/
  2. Scroll down to section Evergreen Bootstrapper, select Download > Accept and Download.
  3. Find the executable file in your Downloads folder, right-click it and select Run as administrator.
  4. Enter your administrator credentials. The installation starts and is completed in the background.

After installing WebView2 this way and restarting Windows, the BotLab client window should show the contents as normal.

I will change the BotLab client to prevent this problem in the future.

Today, I have learned more about the WebView2 dependencies and made progress in adapting the BotLab client.
I just published version 2024-02-10 with an improvement to mitigate this problem.
Instead of the earlier generic error message, the new version displays the installation guide as posted above:

This new guide should avoid confusion in the future. Setups with Windows 11 should never see this error because Microsoft automatically installs WebView2 with Windows Update.

Some observations on the automatic installation in Windows 10: Today, I set up a Windows 10 inside a HyperV VM. With the fresh installation of Windows 10, WebView2 was initially not there, allowing the reproduction of the error message. However, it turned out that Windows Update installed it soon, and after restarting the VM, the BotLab client GUI worked as usual.