Welcome Guest Search | Active Topics | Sign In | Register

Form hangs during the FormClosing event Options
PS
Posted: Friday, April 12, 2019 10:44:13 AM
Rank: Advanced Member
Groups: Member

Joined: 10/24/2018
Posts: 97
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.
eo_support
Posted: Friday, April 12, 2019 11:57:15 AM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,218
Hi,

You will need to update your Windows. This is the same issue discussed here:

https://www.essentialobjects.com/forum/postst11088p2_Form-started-from-webbrowser-is-shown-under-current-form.aspx#47149

The root of the problem is a bug in Windows 1703 related Windows message dispatching, which Microsoft has already fixed. It is not possible for us to patch around all cases since the real problem is not in our code. So you should update your Windows instead of keep beating an outdated version and trying to patch around it.

Thanks!
PS
Posted: Tuesday, April 16, 2019 8:49:20 AM
Rank: Advanced Member
Groups: Member

Joined: 10/24/2018
Posts: 97
Good afternoon,

You are correct, updating to Windows 1703 solved this issue.
eo_support
Posted: Tuesday, April 16, 2019 9:19:56 AM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,218
Great. Thanks for confirming!
PS
Posted: Monday, June 3, 2019 7:29:35 AM
Rank: Advanced Member
Groups: Member

Joined: 10/24/2018
Posts: 97
I'm afraid we have to open this issue again.

It has come to our attention that this exact same bug is reproducing on Windows Server 2016, which has build 1607. Several of our customers are using a terminal server approach, so they will run into this issue.

While we agree with your reasoning on the fact that Windows 10 build 1607 and 1703 will go out end of life very soon, this is not the case for Windows Server 2016. According to this Microsoft information page Windows Server Standard 2016 will receive mainstream support until 11 January 2022 and extended support until 12 January 2027.

Updating these servers is also not an option because that would 1) require a full reinstall and 2) move them out of the Long-Term Servicing Channel (LSTC) to the Semi-Annual Channel, which is not an option. See this page about servicing channels for more information about that.

Given the above information, we request this issue to be fixed for the LSTC version of Windows Server 2016, which uses build 1607.
eo_support
Posted: Monday, June 3, 2019 10:56:34 AM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,218
It is not possible for us to operate this way. It is not technical possible for us to fix such issues on our end when it is clear that the issue is on Microsoft's side, especially when it has already been addressed by them. If your circumstance prevents you to apply Microsoft's fix on this issue, you will need to either resolve that with your customer, or change your code not to work around this. We already gave you a detailed analysis on this particular issue in our other thread, we hopefully that will help you to find a solution to mitigate this issue. In the future we will not respond on such issues.


You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.