[Mono-dev] Bug #360455

Marek Safar marek.safar at seznam.cz
Thu May 21 05:41:02 EDT 2009


Hello Stefan,
> I've been trying to fix https://bugzilla.novell.com/show_bug.cgi?id=360455.
>
> "(g)mcs erroneously raises "x is never used" warning CS0067 with public events"
>
> This happens when the containing class is generic but the event does not use the
> generic type in it's signature. Therre is another test case that
> reproduces the bug
> without generics but contains a class with an abstract event and a derived class
> implementing and using it. Here the warning is uttered erroneously, too.
>   
Please attach your test case to the bug report.

> I looked into the mcs code but I could not quite find out, what's
> going on here, though.
> I believe the interesting part may be that one:
>
> ecore.cs: line 5651, constructor of EventExpr class
>
>                 public EventExpr (EventInfo ei, Location loc)
>                 {
>                         EventInfo = ei;
>
>                         // uninteresting code here
>
>                         if (EventInfo is MyEventBuilder){
>                                 MyEventBuilder eb = (MyEventBuilder) EventInfo;
>                                 type = eb.EventType;
>                                 eb.SetUsed (); // here the event is
> flagged as used
>                         } else
>                                 type = EventInfo.EventHandlerType;
>                 }
>   
It's possible but I won't be sure until I see your test case.

Thanks
Marek


More information about the Mono-devel-list mailing list