sidb
sidb

Reputation: 11

webView.EnsureCoreWebView2Async(null) gives an exception Class not registered

My Code structure is the following:

The project a class library called from an exe

namespace Test
{
    public partial class Browser : UserControl
    {
        public Browser()
        {
            InitializeComponent();
            this.Resize += new System.EventHandler(this.Form_Resize);
            webView.NavigationStarting += EnsureHttps;
            InitializeAsync();
        }
        private async void InitializeAsync()
        {
            await webView.EnsureCoreWebView2Async(null);
            webView.CoreWebView2.WebMessageReceived += UpdateAddressBar;
        }
   }
}

Taken from the Winform example in github.

I am using WebView2 version: 1.0.955-prerelease targeting .NET Framework 4.8 and built using platform=x64

At the line: webView.EnsureCoreWebView2Async(null), I am getting the exception:

An unhandled exception of type 'System.UnauthorizedAccessException' occurred in mscorlib.dll Class not registered

The cache folder: MyProject.dll.WebView2 is also not being created at the default location of the binaries.

Would be very grateful if someone could help out with this error.

Upvotes: 0

Views: 804

Answers (0)

Related Questions