Microsoft Edge WebView2 - Sample crashes on Load


I took the latest version of Microsoft.Web.WebView2 (0.9.515-prerelease) and added to a test C# WinForms application. Am using VS 2019, .NET framework is 4.7.2. Placed the WebView2 control on a form, compiled and ran. The application crashed on Load, at the below point in Form1.designer.cs.

// webView21 // this.webView21.Location = new System.Drawing.Point(153, 66); this.webView21.Name = "webView21"; this.webView21.Size = new System.Drawing.Size(492, 253); this.webView21.Source = new System.Uri("about:blank", System.UriKind.Absolute); this.webView21.TabIndex = 0; this.webView21.Text = "webView21"; this.webView21.ZoomFactor = 1D; // // Form1 // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.ClientSize = new System.Drawing.Size(800, 450); this.Controls.Add(this.webView21); //CRASHED HERE WITH BELOW EXCEPTION -

When I run this in Release mode, get the following exception trace - System.NullReferenceException: Object reference not set to an instance of an object.

at Microsoft.Web.WebView2.WinForms.WebView2.OnVisibleChanged(EventArgs e) at System.Windows.Forms.Control.OnParentVisibleChanged(EventArgs e) at System.Windows.Forms.Control.OnVisibleChanged(EventArgs e) at System.Windows.Forms.ScrollableControl.OnVisibleChanged(EventArgs e) at System.Windows.Forms.Form.OnVisibleChanged(EventArgs e) at System.Windows.Forms.Control.WmShowWindow(Message& m) at System.Windows.Forms.Control.WndProc(Message& m) at System.Windows.Forms.ScrollableControl.WndProc(Message& m) at System.Windows.Forms.Form.WmShowWindow(Message& m) at System.Windows.Forms.Form.WndProc(Message& m) at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m) at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m) at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)

If I take the latest stable version of WebView2 (v 0.9.488), it throws a compilation error as it does not reflect Microsoft.Web

Please let me know how to fix this error. Appreciate your help very much. Came across this question 8 months ago but am hoping Microsoft has gone beyond that now. How can I use the Microsoft Edge WebView2 control in C# windows application

The Sample solution Microsoft created does have C# version as well for WinForms. https://github.com/MicrosoftEdge/WebView2Samples

Tried this sample given by Microsoft as well. It too crashes. https://docs.microsoft.com/en-us/microsoft-edge/webview2/gettingstarted/winforms


you need to make sure 1) the Edge version is right. try download Canary version Edge from Url https://c2rsetup.officeapps.live.com/c2r/downloadEdge.aspx?ProductreleaseID=Edge&platform=Default&version=Edge&source=EdgeInsiderPage&Channel=Canary&language=en

and 2) set x86 as the target platform will fix the problem.


from the path of my Edge, "C:\Program Files (x86)\Microsoft\Edge\Application\msedge.exe", we may conclude the current Edge is 32bit program? wat about give a try setting platform target to x86. some guru said, with x86 set, it will work!

from the MS sample project WebView2WindowsFormsBrowser.csproj, the Microsoft.Web.WebView2 version should be "0.9.515-prerelease".



  • How do I set LINESIZE and PAGESIZE with a substitution variable?
  • CouchDB inner join by document field?
  • How can I restrict EditText to take emojis
  • Sails.js create Index(root) Controller
  • How to connect Android Studio with SQL Server database
  • Build Linux Kernel module with warning i2c_register_board_info undefined
  • How can I add EXIF information to geotag an Image in .NET?
  • Typescript : Check if object exist in array by value
  • Synchronize two vobs on two different hosts
  • jquery: Disable/Enable button not working after reset
  • Decompress string in java from compressed string in C#
  • Html Multiple Input Elements With Same Name
  • How to Include CSS style when converting svg to png
  • GitLab runner on Windows and dealing with & %ERRORLEVEL%
  • Spring Mvc submit/delete checked (selected) records from table
  • Implementing and using MinMax with four in row (connect4) game
  • Planned Contrasts on glmmTMB
  • Directed graph linear algorithm
  • plot dirac function in matlab
  • Loading hyperspectral images in Octave
  • jQuery Ajax call to WCF service returning “Method not allowed (405)”
  • Firestore: Version history of documents
  • How to display converted time zones in a 'generic week' (Sunday thru Saturday)?
  • Keep rows with certain values always at the bottom while sorting in jquery tablesorter plugin
  • Building JavaFX 2.0 App on Mac, deploying on Windows
  • Autocomplete source from project settings
  • Compiling multiple source files in Rcpp
  • Multiplying polynomials/simplifying like terms
  • Add font awesome icon to custom add to cart button in Woocommerce 3
  • how to read to huge file into buffer
  • How to define something in JavaScript [closed]
  • Comparing variables with strings bash
  • Amazon Elastick BeanStalk error: Failed to create the AWS Elastic Beanstalk application version
  • Why isn't stemDocument stemming?
  • How to decleare char *const argv[] in swift [duplicate]
  • How to handle div that is created dynamically in a table
  • Google App Engine backend servlet not responding
  • How to get rgb from transparent pixel in js
  • Grails - How to implement a foreign key relationship not using an id column?
  • Write to .csv file with PHP (Commas in Data Error)