[Mono-bugs] [Bug 74607][Wis] Changed - Delegate InvocationList not correctly updated when events are unhooked

bugzilla-daemon@bugzilla.ximian.com bugzilla-daemon@bugzilla.ximian.com
Thu, 21 Apr 2005 10:40:30 -0400 (EDT)


Please do not reply to this email- if you want to comment on the bug, go to the
URL shown below and enter your comments there.

Changed by jonpryor@vt.edu.

http://bugzilla.ximian.com/show_bug.cgi?id=74607

--- shadow/74607	2005-04-21 10:34:06.000000000 -0400
+++ shadow/74607.tmp.20299	2005-04-21 10:40:30.000000000 -0400
@@ -1,14 +1,14 @@
 Bug#: 74607
 Product: Mono: Runtime
 Version: 1.1
-OS: 
+OS: unknown
 OS Details: Ubuntu Hoary with Mono from SVN (20050413)
 Status: NEW   
 Resolution: 
-Severity: 
+Severity: Unknown
 Priority: Wishlist
 Component: misc
 AssignedTo: mono-bugs@ximian.com                            
 ReportedBy: larsde@key2network.com               
 QAContact: mono-bugs@ximian.com
 TargetMilestone: ---
@@ -118,6 +118,38 @@
 
 
 ------- Additional Comments From jonpryor@vt.edu  2005-04-21 10:34 -------
 Created an attachment (id=14991)
 Shorter Demo
 
+
+------- Additional Comments From jonpryor@vt.edu  2005-04-21 10:40 -------
+The shorter demo has a #if block to alter behavior.  To view the bug,
+compile without any defines:
+
+    $ mcs del.cs && mono del.exe
+    Compilation succeeded
+    Invocation List Length: 2
+    Handler invoked!
+    Handler invoked!
+    Invocation List Length: 2
+    Handler invoked!
+
+To "fix" the bug, compile with -define:WORKING:
+
+    $ mcs -define:WORKING del.cs && mono del.exe
+    Compilation succeeded
+    Handler invoked!
+    Handler invoked!
+    Invocation List Length: 1
+    Handler invoked!
+
+The difference between the two versions?  Whether or not
+Delegate.GetInvocationList() is invoked.  Once GetInvocationList() is
+invoked, subsequent calls to GetInvocationList() returns the maximum
+length that the invocation list ever was.  (If you add 3 delegates,
+call GetInvocationList, and remove 2, you'll get 3; add another 3
+delegates, GetInvocationList will return 4, remove 3, and you still
+get 4.)
+
+The question still remains: Why does calling GetInvocationList behave
+in this fashion?