Notice (2018-05-24): bugzilla.xamarin.com is now in
Please join us on
Visual Studio Developer Community and in the
Mono organizations on
GitHub to continue tracking issues. Bugzilla will remain
available for reference in read-only mode. We will continue to work
on open Bugzilla bugs, copy them to the new locations
as needed for follow-up, and add the new items under Related
Our sincere thanks to everyone who has contributed on this bug
tracker over the years. Thanks also for your understanding as we
make these adjustments and improvements for the future.
Please create a new report for Bug 15848 on
GitHub or Developer Community if you have new
information to add and do not yet see a matching new report.
If the latest results still closely match this report, you can use the
In special cases on GitHub you might also want the comments:
GitHub Markdown with public comments
Created attachment 5292 [details]
Complete solution showing the problem
Mono apparently fails to send the Deactivate event to a Form when another form is activated by calling its Activate() method.
The attached program demonstrates the problem. When run on Windows (you might need to rename the three .resources files to their original .resx names to build with VS), click "button1" on the original form; the popup form appears. Click "button1" in the popup form, and a message box appears. On Windows, the popup form is hidden; on Mono, it stays around.
The reason it should get hidden is because of code in its constructor (PopupForm.PopupForm):
this.Deactivate += (sender, args) => this.Hide();
The action (this.Hide()) executes on Windows when _parentWindow.Activate() is called in PopupForm.button1_Click.
On Mono this action does not execute.
The fact that a third window (the message box) is activated immediately afterwards may be something to do with the problem.
Curiously, the event is raised properly (on both platforms) if the user manually clicks on another window. Somehow the explicit call to Activate() does not raise it.
(We are using our own build of Mono 2.10, with various bugs fixed. I haven't tried this with an unmodified 2.10, but I don't think we've changed anything relevant.)
Setting priority to lowest, since Windows.Forms is no longer being developed actively.