Bug 24058 - NSControl.Activated event delegate is only accepting one event handler.
Summary: NSControl.Activated event delegate is only accepting one event handler.
Alias: None
Product: Xamarin.Mac
Classification: Desktop
Component: Library (Xamarin.Mac.dll) ()
Version: 1.11.0
Hardware: Macintosh Mac OS
: Normal normal
Target Milestone: 2.0.x
Assignee: Chris Hamons
Depends on:
Reported: 2014-10-26 12:24 UTC by Johan H
Modified: 2015-03-03 10:52 UTC (History)
5 users (show)

Is this bug a regression?: ---
Last known good build:

Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and 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 Links.

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 on Developer Community or GitHub with your current version information, steps to reproduce, and relevant error messages or log files if you are hitting an issue that looks similar to this resolved bug and you do not yet see a matching new report.

Related Links:

Description Johan H 2014-10-26 12:24:31 UTC
The code below shows that only one event handler may be setup at any time for the Activated event. When an event handler is added any previously added event handler will no longer be invoked for the event. Obviously this will lead to unexpected behavior where an added event handler suddenly no longer gets fired only because another part of the application has subsequently added an event handler for the event.

public event EventHandler Activated {
	add {
		this.Target = ActionDispatcher.SetupAction (this.Target, value);
		this.Action = ActionDispatcher.Action;
	remove {
		ActionDispatcher.RemoveAction (this.Target, value);
Comment 1 Ram Chandra 2014-10-28 13:49:17 UTC
I have checked the definition of "NSControl" class in assembly browser and I observed the following definition of Activated event in NSControl class.

public event EventHandler Activated
		this.Target = ActionDispatcher.SetupAction(this.Target, value);
		this.Action = ActionDispatcher.Action;
		ActionDispatcher.RemoveAction(this.Target, value);

I’ll need confirmation from the developer if this is a bug. 

Leaving as NEW for now.
Comment 2 Chris Hamons 2014-12-03 17:04:53 UTC
I believe this and https://bugzilla.xamarin.com/show_bug.cgi?id=19619 are the same bug, but will leave both open until we research a fix.
Comment 3 Timothy Risi 2015-02-25 13:01:42 UTC
Fixed in master / 18454 - Can't add an event handler to a button after removing an event handler from that button.
Comment 4 Abhishek 2015-03-03 10:52:39 UTC
I have checked this issue with the following builds:

Xamarin Studio Version 6.0 (build 9)
Installation UUID: 93e693b0-b53d-40f4-b29c-b61ff5cbe892
Mono 4.0.0 ((detached/2634099)
GTK+ 2.24.23 (Raleigh theme)
Package version: 400000017
Apple Developer Tools Xcode 6.1 (6604)
Build 6A1052d
Xamarin.Mac Version: (Enterprise Edition)
=== Build Information ===
Release ID: 600000009
Git revision: d73d00b7002067b75f5181bf6b1553125fc51129
Build date: 2015-03-03 04:30:46-05
Xamarin addins: 36cdf9c68b1b93c6bf55be6a3f6d2bcb4ea1ebec
Operating System Mac OS X 10.10.0
Darwin 800BC.local 14.0.0 Darwin Kernel Version 14.0.0
Fri Sep 19 00:26:44 PDT 2014
root:xnu-2782.1.97~2/RELEASE_X86_64 x86_64

This issue is working fine now. I observed that NSControl.Activated event delegate is now accepting multiple event handler. Here is the screencast for the same:http://www.screencast.com/t/HnczP9gtLby

This issue has been fixed, hence I am closing this issue.