[Mono-bugs] [Bug 70129][Nor] Changed - Private events are not really private

bugzilla-daemon@bugzilla.ximian.com bugzilla-daemon@bugzilla.ximian.com
Thu, 2 Dec 2004 22:30:26 -0500 (EST)


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 duncan@ximian.com.

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

--- shadow/70129	2004-12-02 07:35:57.000000000 -0500
+++ shadow/70129.tmp.3910	2004-12-02 22:30:26.000000000 -0500
@@ -5,13 +5,13 @@
 OS Details: 
 Status: NEW   
 Resolution: 
 Severity: Unknown
 Priority: Normal
 Component: C#
-AssignedTo: mono-bugs@ximian.com                            
+AssignedTo: duncan@ximian.com                            
 ReportedBy: lluis@ximian.com               
 QAContact: mono-bugs@ximian.com
 TargetMilestone: ---
 URL: 
 Cc: 
 Summary: Private events are not really private
@@ -57,6 +57,38 @@
 relates to events, so I just removed it.
 
 ------- Additional Comments From duncan@ximian.com  2004-12-02 07:35 -------
 Created an attachment (id=13384)
 event-visibility.patch
 
+
+------- Additional Comments From duncan@ximian.com  2004-12-02 22:30 -------
+Here's a newer patch. It deals with this additional case:
+
+// error CS0122: 'A.AnEvent' is inaccessible due to its
+// protection level
+//
+// NOTE: if Member were a field or a property, this'd result 
+// in a CS1540
+
+using System;
+
+class A
+{
+       protected event EventHandler Member;
+}
+
+class B : A
+{
+       static void Main ()
+       {
+               A a = new A ();
+               a.Member += Handler;
+       }
+       
+       static void Handler (object sender, EventArgs args) {}
+}
+
+I fixed this by copying PropertyExpr.InstanceResolve into EventExpr.
+That means there are now 2 identical methods inside PropertyExpr and
+EventExpr. Maybe it's time to add a new common base class for the two,
+so that these 2 methods can be shared.