[Mono-bugs] [Bug 71073][Wis] Changed - unfixable warning cs0067 "event not used"
bugzilla-daemon@bugzilla.ximian.com
bugzilla-daemon@bugzilla.ximian.com
Mon, 9 May 2005 17:09:21 -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 robertj@gmx.net.
http://bugzilla.ximian.com/show_bug.cgi?id=71073
--- shadow/71073 2005-02-14 19:30:45.000000000 -0500
+++ shadow/71073.tmp.8381 2005-05-09 17:09:21.000000000 -0400
@@ -10,12 +10,13 @@
Component: C#
AssignedTo: mono-bugs@ximian.com
ReportedBy: danw@novell.com
QAContact: mono-bugs@ximian.com
TargetMilestone: ---
URL:
+Cc: marek.safar@seznam.cz,robertj@gmx.net
Summary: unfixable warning cs0067 "event not used"
If an interface defines an event, and an implementation of that
interface never invokes the event, mcs complains:
using System;
@@ -47,6 +48,26 @@
that warning is just noise.
------- Additional Comments From miguel@ximian.com 2005-02-14 19:30 -------
Am CCing Marek.
Marek, do you think you could look at this?
+
+------- Additional Comments From robertj@gmx.net 2005-05-09 17:09 -------
+I don't think this is an issue.
+
+In both cases (abstract base class or interface defining
+an event) the warning can be avoided using empty "add" and
+"remove" accessors:
+
+ public class Foo : IFoo {
+ ...
+ public event EventHandler blah {
+ add {}
+ remove {}
+ }
+ }
+
+The warning is even useful: it reminds you that you *should*
+use add {} and remove {} to avoid the generation of the
+unnecessary hidden delegate.
+