Skip to content

Suppressions for CA1811:AvoidUncalledPrivateCode should be respected by IDE0051 #33314

@davkean

Description

@davkean

CPS code base has a bunch of "unused" things that look like this:

        /// <summary>
        /// Wires up this service to event notifications that it needs to respond to.
        /// </summary>
        [ConfiguredProjectAutoLoad]
        [AppliesTo(ProjectCapabilities.Cps + " & " + ProjectCapabilities.ProjectReferences)]
        [SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode", Justification = "Called by MEF")]
        private void WireUp()
        {
            this.ShellServices.ProjectRenamedInSolution += this.ShellServices_ProjectRenamedInSolution;
            this.ShellServices.ProjectRemovedFromSolution += this.ShellServices_ProjectRemovedFromSolution;
        }

For these we get IDE0051:

Severity	Code	Description	Project	File	Line	Category	Suppression State
Message	IDE0051	Private member 'ProjectReferenceMaintenanceService.WireUp' is unused.	Microsoft.VisualStudio.ProjectSystem.VS.Implementation	E:\CPS\src\Microsoft.VisualStudio.ProjectSystem.VS.Implementation\ProjectReferenceMaintenanceService.cs	106	Code Quality	Active

IDE0051 is exactly the same rule as CA1811, except that it has been removed to the Roslyn tree and renamed. In FxCop days, when we merged rules, we had a mapping table so that existing suppressions would be respected by the new rule. Roslyn should have the same thing.

CPS code base has over 200 instances of this.

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

Status

Complete

Relationships

None yet

Development

No branches or pull requests

Issue actions