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:
- Create an extension block
- Create an extension method within that block
- Create a private method within the extension block which uses the extended type
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
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:
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