0

when attempting to replace an AxWebBrowserwith WebView2 in an old winform form i get an "invalid window handle 0x80070578" exception.

at first it was due to an older version of Edge but after dating to Canary it was working fine in a standalone project.

async void InitializeAsync()
{
    await webView.EnsureCoreWebView2Async(null); //this throws an exception
}

what am i missing?

Danw25
  • 306
  • 2
  • 13

1 Answers1

0

Well, after a day of trying anything i could think of i noticed that the winform did not have a separate file for the designer. this got me thinking that maybe this is a compatibility thing (original form was created ~2015) so i attempted to recreate the winform in VS 2019.

recreating the form worked as expected. it runs smoothly now. also worth noting that the older form had this line

this.StartPosition = System.Windows.Forms.FormStartPosition.Manual;
Dharman
  • 30,962
  • 25
  • 85
  • 135
Danw25
  • 306
  • 2
  • 13