I am creating a object of Microsoft.Web.WebView2.WinForm.WebView2 but the sub obect of this coreWebView2 is null
Microsoft.Web.WebView2.WinForm.WebView2 webView = new Microsoft.Web.WebView2.WinForm.WebView2()
// Change some GUI properties of webView
webView.CoreWebView.NavigateUrl(url)
// I can not access the above line because CoreWebView is null
Use the
EnsureCoreWebView2Asyncmethod to initialize the underlyingCoreWebView2property. This is documented on MSDN. This property isnullon initialization of theWebView2class object.Source (https://learn.microsoft.com/en-us/microsoft-edge/webview2/reference/winforms/0-9-515/microsoft-web-webview2-winforms-webview2)