int x;
int X {
get { return x; }
set { x = value; }
}
or other trivial thing, in which it is not necessary to warn about unused code. For example, a method may set 'x' directly, rather than using the property, in which case Gendarme will complain that the setter was never utilized.
using System;
class Test
{
event EventHandler<EventArgs> TestEvent; // <----- Gendarme complains that add_ and remove_ are never used
int _i;
int TestProp { // <----- Gendarme complains that get_ and set_ are never used
get { return _i; }
set { _i = value; }
}
int TestProp2 { get; set; } // <----- Gendarme recognizes these as automatically generated
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<System.EventArgs>)
* 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<System.EventArgs>)
* 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)
4. AvoidUncalledPrivateCodeRule
Problem: This private or internal (assembly-level) member does not have callers in the assembly, is not invok
* Severity: High, Confidence: Normal
* Target: System.Int32 Test::get_TestProp()
* 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.AvoidUncalledPri
5. AvoidUncalledPrivateCodeRule
Problem: This private or internal (assembly-level) member does not have callers in the assembly, is not invok
* Severity: High, Confidence: Normal
* Target: System.Void Test::set_TestProp(System.Int32)
* 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.AvoidUncalledPri