Microsoft has finally released a pre-release of Webview2 for .NET. I followed the steps, but I keep getting a NullReferenceException on loading the form. How can I fix this?
System.InvalidOperationException: 'An error occurred creating the form. See Exception.InnerException
for details. The error is: Object reference not set to an instance of an object.'
NullReferenceException: Object reference not set to an instance of an object.
This exception was originally thrown at this call stack:
Microsoft.Web.WebView2.WinForms.WebView2.OnVisibleChanged(System.EventArgs)
System.Windows.Forms.Control.AssignParent(System.Windows.Forms.Control)
System.Windows.Forms.Control.ControlCollection.Add(System.Windows.Forms.Control)
System.Windows.Forms.Form.ControlCollection.Add(System.Windows.Forms.Control)
Repair_VIP.Form_test.InitializeComponent() in Form_test.Designer.vb
I also got nullreferenceexception on CoreWebView2. When calling webView. CoreWebView2.NavigateToString(); I added this before calling the Navigate method.
await webView.EnsureCoreWebView2Async(null);
and everything worked fine.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With