IDE0052 is incorrectly reported for a member referenced by nameof(...)
See original GitHub issueThis issue has been moved from a ticket on Developer Community.
[severity:It’s more difficult to complete my work] [regression] [worked-in:17.3] Have this NUnit test class:
[TestFixture]
public class TestClass {
private readonly int[] values; // IDE0052
[Test]
[TestCaseSource(nameof(values))]
public void TestMethod(int[] values) {
/// bla bla
}
}
VS 17.4 reports that “values” is not referred and can be removed despite that nameof
references it.
Original Comments
Feedback Bot on 11/8/2022, 04:55 PM:
(private comment, text removed)
Original Solutions
(no solutions)
Issue Analytics
- State:
- Created 10 months ago
- Comments:12 (6 by maintainers)
Top Results From Across the Web
IDE0052 incorrectly suggested for entire property when ...
SetSource: yes, like I mentioned: It should not report IDE0052 on the whole property. If anything, it should be reported on just the...
Read more >IDE0052: Remove unread private member - .NET
Remove unread private member (IDE0052) This rule flags private fields and properties that have one or more write references but no read ...
Read more >IDE0052 Incorrectly identifies private member as "can be ...
Create a class that contains the following private member: private static readonly Timer writerTimer = new Timer((state) => ProcessQueue(), ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
@ssg Generators deal with the compiler API, so I guess nothing blocks them from knowing that info.
@Youssef1313 I’m not surprised that compiler knows about it, but do you know if, say, source generators also have access to that information?