Skip to content

Latest commit

 

History

History
59 lines (39 loc) · 1.88 KB

ca1811.md

File metadata and controls

59 lines (39 loc) · 1.88 KB
title description ms.date ms.topic f1_keywords helpviewer_keywords author ms.author manager ms.subservice
CA1811: Avoid uncalled private code
A 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.
11/04/2016
reference
AvoidUncalledPrivateCode
CA1811
CA1811
AvoidUncalledPrivateCode
mikejo5000
mikejo
mijacobs
code-analysis

CA1811: Avoid uncalled private code

Item Value
RuleId CA1811
Category Microsoft.Performance
Breaking change Non-breaking

Cause

A 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. The following members are not checked by this rule:

  • Explicit interface members.

  • Static constructors.

  • Serialization constructors.

  • Methods marked with xref:System.Runtime.InteropServices.ComRegisterFunctionAttribute?displayProperty=fullName or xref:System.Runtime.InteropServices.ComUnregisterFunctionAttribute?displayProperty=fullName.

  • Members that are overrides.

Rule description

This rule can report false positives if entry points occur that are not currently identified by the rule logic. Also, a compiler might emit noncallable code into an assembly.

How to fix violations

To fix a violation of this rule, remove the noncallable code or add code that calls it.

When to suppress warnings

It is safe to suppress a warning from this rule. To do so, see Suppress code analysis warnings.

Related rules

CA1812: Avoid uninstantiated internal classes

CA1801: Review unused parameters

CA1804: Remove unused locals