And a thorough description of the problem / question:
The following line of code triggered the warning S2933 (“Make xxx readonly”). private bool isFrontRendering = true;
But, in one of the functions of this class, i call the following function: isFrontRendering.Toggle();
Defined by:
public static void Toggle(this ref bool value) {
value = !value;
}
As the value changes by reference inside the extension functions, the rule S2933 should not appear.
Hi @Agentew04! I confirm this as a FP, at this moment we do not support extension methods. Thanks a lot for reporting it, I added a reproducer on our side to keep track of it.
public class MyClass
{
private bool myField = true; // FP
public void ToggleField()
{
myField.Toggle();
}
}
public static class BoolExtension
{
public static void Toggle(this ref bool value)
{
value = !value;
}
}