I’m currently going through the process of running FxCop through our application that has been in development for around a year already.
One rule that I am unsure of is UseGenericEventHandlersInstances. I understand how to implement it, but don’t really see the benefit, other than saving the step of having to define a delegate for each custom event handler. In our case, we already have these delegates created and I wonder if we have any benefit of changes our event handlers or should just disable this rule.
In my limited experience almost all FxCop rules appear to be adhered to be Microsoft and the .NET framework. However, in this case that is not true. The .NET framework uses the traditional approach that we have used, with declaring delegates, at least for all of the mouse and keybaord event handlers which were the ones that I investigated.
Nobody knows why Microsoft does or does not do something, but this further makes me questions the validity and benefit of this rule.
Most of the non-generic delegates that you see in recent versions of the .NET BCL were created before generics were introduced. Changing the pre-existing events to use EventHandler would be a breaking change, as would removing the public ___EventHandler delegates that might be used by other code. However, there is quite a bit of EventHandler use for new events exposed by the BCL, so it would be incorrect to assume that Microsoft is not abiding by the rule for new code.
In your case, if changing older event declarations would be a breaking change or would have low value, you could opt to suppress existing violations of the rule. You could, of course, also choose to ignore the rule even for new events, although I’m not sure why one would want to do so given that following the rule actually avoids unnecessary work for the original developer while enhancing API useability.