
org.sonar.plugins.csharp.S3264.html Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of sonarlint-omnisharp-plugin Show documentation
Show all versions of sonarlint-omnisharp-plugin Show documentation
Code Analyzer based on Omnisharp
Why is this an issue?
Events that are not invoked anywhere are dead code, and there’s no good reason to keep them in the source.
Noncompliant code example
class UninvokedEventSample
{
private event Action<object, EventArgs> Happened; // Noncompliant
public void RegisterEventHandler(Action<object, EventArgs> handler)
{
Happened += handler; // we register some event handlers
}
public void RaiseEvent()
{
if (Happened != null)
{
// Happened(this, null); // the event is never triggered, because this line is commented out.
}
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy