We just discovered an issue in the WinForms implementation of the WebBrowser control.
In our application we have a form that contains a WebControl, and we have attached a FormClosing event handler in order to ask the user whether the form should really be closed if there are still unsaved changes in progress. Please note that we also have a CancelButton specified on the form.
When the form is closed we display a MessageBox, and when the MessageBox is displayed the application seems to hang or deadlock.
Code to reproduce this issue:
Quote:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading;
using System.Threading.Tasks;
using System.Windows.Forms;
using EO.WebBrowser;
using EO.WinForm;
namespace EOTest
{
    static class Program
    {
        /// <summary>
        /// The main entry point for the application.
        /// </summary>
        [STAThread]
        static void Main()
        {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            Application.Run(CreateTestForm());
        }
        private static Form CreateTestForm()
        {
            EO.WebEngine.Engine.Default.Options.DisableGPU = true;
            var form = new Form1();
            var webControl = new WebControl
            {
                Dock = DockStyle.Fill,
                TabStop = false
            };
            var webView = new WebView
            {
                Url = "https://www.google.com"
            };
            webControl.WebView = webView;
            form.Controls.Add(webControl);
            Button btn = new Button();
            btn.Click += (sender, e) => {
                form.Close();
                webView.Dispose();
                webControl.Dispose();
            };
            form.Controls.Add(btn);
            btn.Dock = DockStyle.Top;
            form.CancelButton = btn;
            form.FormClosing += (sender, e) =>
            {
                var dialogResult = MessageBox.Show("You have unsaved changes, are you sure you want to exit?", "Are you sure?", MessageBoxButtons.YesNoCancel);
                switch (dialogResult)
                {
                    case DialogResult.Cancel:
                    case DialogResult.No:
                        e.Cancel = true;
                        break;
                    default:
                        break;
                }
            };
            var textBox = new TextBox
            {
                Dock = DockStyle.Bottom
            };
            form.Controls.Add(textBox);
            return form;
        }
    }
}
 Steps to reproduce this issue:
1. Put the focus inside the webbrowser, for example in the search bar of Google.
2. Press ESC.
3. Observe that the application hangs.
We expect the application to not hang.