dotnet/roslyn

IDE0060 (Remove unused parameter) false positive for interpolated string handler argument

Open

#76,578 opened on Dec 29, 2024

View on GitHub
 (0 comments) (1 reaction) (0 assignees)C# (4,257 forks)batch import
Area-IDEBugFeature - IDE0060help wanted

Repository metrics

Stars
 (20,414 stars)
PR merge metrics
 (Avg merge 6d 17h) (256 merged PRs in 30d)

Description

Version Used:

VS 17.13 Preview 1

Steps to Reproduce:

public static void M(bool x, [InterpolatedStringHandlerArgument(nameof(x))] ref MyInterpolatedStringHandler y)
{
    // Do something with message. Analyzer will complain that `x` parameter isn't used. But it's actually used as the value will be passed to `MyInterpolatedStringHandler`
}

Diagnostic Id: IDE0060 (Remove unused parameter)

Expected Behavior:

No diagnostic

Actual Behavior:

False positive diagnostic

Contributor guide