This problem actually applies to the legacy CodeRush as well it seems.
Consider the following classes:
C#class MyAttribute : Attribute
{
public MyAttribute(bool isSet)
{
IsSet = isSet;
}
public bool IsSet { get; }
}
[My(true)]
class Program
{
static void Main(string[] args)
{
bool value = true;
MyAttribute attr = new MyAttribute(false);
attr = new MyAttribute(value);
}
}
If you place the cursor on the isSet parameter of the MyAttribute constructor, and invoke the "Reverse Boolean" refactoring, the usages are updated everywhere, except when the class is used as an attribute. So [My(true)] is left unchanged, when it should have been changed to [My(false)] .
Peter,
Thank you for the provided sample code. I have reproduced this issue and passed it to our developers to fix.
It seems this problem applies to the "Boolean to enum" conversion as well.
Peter,
Thank you for the additional information. It seems that it is a similar issue but in different refactoring, and it will be better to discuss it in a separate thread.
So, I have created a new ticket on your behalf: Boolean to Enum refactoring does not update ctor parameters in attributes. Please refer to it for further correspondence.
Great, thank you very much.