[Mono-bugs] [Bug 59640][Nor] New - mcs event attributes to add/remove methods instead of event itself

bugzilla-daemon@bugzilla.ximian.com bugzilla-daemon@bugzilla.ximian.com
Sat, 5 Jun 2004 23:59:04 -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 mathpup@mylinuxisp.com.

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

--- shadow/59640	2004-06-05 23:59:04.000000000 -0400
+++ shadow/59640.tmp.17669	2004-06-05 23:59:04.000000000 -0400
@@ -0,0 +1,72 @@
+Bug#: 59640
+Product: Mono: Compilers
+Version: unspecified
+OS: 
+OS Details: 
+Status: NEW   
+Resolution: 
+Severity: 
+Priority: Normal
+Component: C#
+AssignedTo: mono-bugs@ximian.com                            
+ReportedBy: mathpup@mylinuxisp.com               
+QAContact: mono-bugs@ximian.com
+TargetMilestone: ---
+URL: 
+Cc: 
+Summary: mcs event attributes to add/remove methods instead of event itself
+
+Description of Problem: 
+ 
+If SignalAttribute is an attribute that can be attached to any target, the 
+C# spec indicates that by default the attribute is attached to the event 
+itself, rather than the field or add/remove methods. (The spec discusses 
+this in section 24.2, p. 313, fourth bulleted item.) However, mcs is 
+associating the attribute with the add/remove methods. 
+ 
+The program below illustrates the problem: 
+ 
+using System; 
+ 
+ 
+[AttributeUsage(AttributeTargets.All)] 
+public class SignalAttribute: Attribute {} 
+ 
+public class Test 
+{ 
+	public delegate void DelType(); 
+ 
+	[SignalAttribute] 
+	public event DelType MyEvent; 
+ 
+	public static void Main() {} 
+} 
+ 
+csc produces the CIL 
+ 
+  .event Test/DelType MyEvent 
+  { 
+    .custom instance void SignalAttribute::.ctor() = ( 01 00 00 00 )  
+    .addon instance void Test::add_MyEvent(class Test/DelType) 
+    .removeon instance void Test::remove_MyEvent(class Test/DelType) 
+  } // end of event Test::MyEvent 
+} // end of class Test 
+ 
+ 
+but mcs produces 
+ 
+  .event specialname rtspecialname Test/DelType MyEvent 
+  { 
+    .addon instance void Test::add_MyEvent(class Test/DelType) 
+    .removeon instance void Test::remove_MyEvent(class Test/DelType) 
+  } // end of event Test::MyEvent 
+} // end of class 
+ 
+and then 
+ 
+  .method public hidebysig specialname instance void  
+          add_MyEvent(class Test/DelType 'value') cil managed 
+  { 
+    .custom instance void SignalAttribute::.ctor() = ( 01 00 00 00 ) 
+	// etc 
+   }