spouliot/gendarme — Issue #3: AvoidUncalledPrivateCodeRule fires on generated event methods
Author: troberson
Created: 2012-01-25 20:35:14+00:00
State: open

The AvoidUncalledPrivateCodeRule fires on generated methods from events:

using System;

class Test
{
event EventHandler TestEvent;

static void Main ()
{
new Test ();
}
}
---

2. AvoidUncalledPrivateCodeRule

Problem: This private or internal (assembly-level) member does not have callers in the assembly, is not invoked by the common language runtime, and is not invoked by a delegate.
* Severity: High, Confidence: Normal
* Target: System.Void Test::add_TestEvent(System.EventHandler`1)
* Details: The private method code is not used in its declaring type.

Solution: Remove the unused code or add code to call it.
More info available at: https://github.com/spouliot/gendarme/wiki/Gendarme.Rules.Performance.AvoidUncalledPrivateCodeRule(2.10)

3. AvoidUncalledPrivateCodeRule

Problem: This private or internal (assembly-level) member does not have callers in the assembly, is not invoked by the common language runtime, and is not invoked by a delegate.
* Severity: High, Confidence: Normal
* Target: System.Void Test::remove_TestEvent(System.EventHandler`1)
* Details: The private method code is not used in its declaring type.

Solution: Remove the unused code or add code to call it.
More info available at: https://github.com/spouliot/gendarme/wiki/Gendarme.Rules.Performance.AvoidUncalledPrivateCodeRule(2.10)