Resharper - Encapsulate Field always has Write usages
Resharper used to allow me to Encapsulate a field in a C# class and have it have be a Read Only field (i.e a getter only), however something has changed recently and it always has Write usages now and the tickbox can't be unticked.
This is irritating as I work almost exclusively with immutable objects and after using EncapsulateField I always have to delete the setter.
Has something changed here or have I changed a setting?
How do I make it go back to defaulting to Read usages only?
A further problem:
After I apply this, it changes the line in the constructor from _disconnectionTime = disconnectionTime to DisconnectionTime = disconnectionTime but that field is readonly.
????
This does NOT build.
This seems completely broken.
It used to generate the following
Its no longer recongising that the field its encapuslating is readonly, trying to give write usages to a readonly field and for some reason changing the setting of the readonly field.
Please sign in to leave a comment.
Hello Stuart!
Thank you for the detailed feedback.
I've filed corresponding issue - https://youtrack.jetbrains.com/issue/RSRP-471665.
Please follow the issue to get the latest updates on it. You are welcome to comment or vote for it as well.
Thank you.