Developing and testing features or extensions for Microsoft Edge
This browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
I am trying to create a COM component for creating CoreWebView2. The steps I am following are, 1. CoreWebView2Environment.CreateAsync 2. envObject.CreateCoreWebView2ControllerAsync In step 2, I get an NotImplemented exception with message "Unable to cast to Microsoft.Web.WebView2.Core.Raw.ICoreWebView2Environment. This may happen if you are using an interface not supported by the version of the WebView2 Runtime you are using. For instance, if you are using an experimental interface from an older SDK that has been modified or removed in a newer runtime. Or, if you are using ........" I checked and double checked, Edge Chromium version and WebView2 Runtime version on my machine is same that is "87.0.664.75". Nuget that I am using is Microsoft.Web.WebView2 - Version 1.0.664.37. I checked the versioning concept page for Edge WebView2 (this Nuget version requires minimum WebView2 Runtime version 86.0.616.0) and according to the page I am using correct version of Runtime vs Nuget version. Can someone please help me with this one, Whether my understanding is correct or I am doing something wrong here or this is a genuine bug ? I am working with Windows 10.
Developing and testing features or extensions for Microsoft Edge
I am trying to create WebView2 with following 3 statements in a function.
var webview2Environment = await CoreWebView2Environment.CreateAsync(string.Empty, strUserDataFolder, null);
var webview2Controller = await webview2Environment.CreateCoreWebView2ControllerAsync(ptr);
var webView = webview2Controller.CoreWebView2;
Thanks for the response. The Nuget version and WebView2 Runtime can be referenced from my very first request in this thread.
I am doing the same with given nuget version and WebView2 Runtime as mentioned in first message in this thread. After creating the Envrionment when I try creating WebView2Controller, that is when I get the error. The error text is mentioned in the first message as well. The error message is pointing me to verify Nuget Version vs minimum required WebView2 Runtime version. I have the correct combination and yet I get this error all the time. I am not able to create WebView2Controller, CreateAsync on CoreWebView2Environment is the only statement that executes without error.
@Anonymous , the strUserDataFolder is directory path and ptr is handle for parent window. yes, trying to use the code in Windows Forms app.