Skip to content

IDE0051 broken in .NET 10 release #81213

@burnchar

Description

@burnchar

IDE0051 flags when a private method exists within an extension block.
While such a method should probably exist outside of the extension block, the error "{method} is unused" is confusing and incorrect.
Notably, Rider's "convert extension method to extension block" refactor moves such methods into the extension block by default, so their refactor tool may need some help from the JetBrains team as well (which, I know, is unrelated to the Roslyn team or Microsoft).

Version Used:
.NET 10 initial public full release

Steps to Reproduce:

  1. Create an extension block
  2. Create an extension method within that block
  3. Create a private method within the extension block which uses the extended type
Image

A minimal repro, with source-code provided, is ideal. Most compiler/language issues can be distilled into a snippet that can be pasted into .NET Lab.

Diagnostic Id:

IDE0051: Private member 'ServiceCollectionExtensions.extension(IServiceCollection).CreateDatabasePropagationHelper' is unused

Expected Behavior:
IDE0051 not triggered

Actual Behavior:
IDE0051 triggered

Metadata

Metadata

Assignees

No one assigned

    Labels

    Area-IDEhelp wantedThe issue is "up for grabs" - add a comment if you are interested in working on it

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions