Reporter | Joe White (joewhite) |
---|---|
Created | Mar 3, 2011 7:40:40 PM |
Updated | Apr 11, 2018 6:17:12 PM |
Subsystem | Quick Fixes |
Assignee | Ivan Serduk (IvanSerduk) |
Priority | Major |
State | Open |
Type | Usability Problem |
Fix version | Backlog |
Affected versions | 2018.1 |
Fixed In Version ReSharper | Undefined |
VsVersion | All Versions |
I often write an object with public, read/write auto properties that are set by outside code, and read only by the object itself. In these cases, ReSharper will put a green wavy underline under the auto property's "get" keyword, with hint "Accessor 'MyProperty.get' can be made private", and will show a quick-fix menu with "Make 'get' accessor private".
If I apply this quick-fix, I end up with a bad design. Write-only properties are frowned upon, and a property with a public setter but private getter is write-only as far as the outside world is concerned. Since the fix is worse than the "problem", I don't want Resharper to show me the warning in the first place.
I could disable the warning in ReSharper options, but then I wouldn't get warnings about setters that could be private, and I do want to know about those. (There's nothing wrong with read-only properties.)
Give me a way to disable the warning for getters, while still seeing it for setters. One option might be to change the inspection rules so that it never shows the warning for getters. Another option might be to split it into two warnings, one for the getter and one for the setter, so I can use either ReSharper options or "Suppress inspection with comment" to manually disable the getter warning while still having the setter warning.
If I apply this quick-fix, I end up with a bad design. Write-only properties are frowned upon, and a property with a public setter but private getter is write-only as far as the outside world is concerned. Since the fix is worse than the "problem", I don't want Resharper to show me the warning in the first place.
I could disable the warning in ReSharper options, but then I wouldn't get warnings about setters that could be private, and I do want to know about those. (There's nothing wrong with read-only properties.)
Give me a way to disable the warning for getters, while still seeing it for setters. One option might be to change the inspection rules so that it never shows the warning for getters. Another option might be to split it into two warnings, one for the getter and one for the setter, so I can use either ReSharper options or "Suppress inspection with comment" to manually disable the getter warning while still having the setter warning.