Faulty reassigned variable marker on for loop?
I have my for loop variable underscored, and I think this is by mistake. The local variable is only used in the loop, its not reassigned anywhere and its used in every cycle. I see no reason for warning, and there is no warning on the hover. Yet, it remains underscored. Other local vars are not, and when I convert this to a while-loop its not underscored either, so it leads me to believe something is wrong with for loop check.
Using 2023.3 EAP1

Please sign in to leave a comment.
It's probably because it's “mutated”. Look for the “Mutable local variable” style under Settings → Editor → Color Scheme → C# → Properties and Variables. (Inherited from Language Defaults → Reassigned local variable).
Probably your current setting says to underline/underscore it.
(Note: I'm not JetBrains).
Dave is right. Rider highlights mutable variables in that way. Please let us know if you have any questions.
Have a nice day!
Since when is mutability of variables an issue that needs to be marked? I mean, variability is literally in their name, the variables.
What am I missing here?
By this, Rider marks local variable that changes their value several times per a method. If a variable initialized in a method doesn't change its value, there will be no such highlighting. This highlighting allows visually seeing the variables that change their value during method execution.
This is an old behavior (I just verified it in 2022.2.4 and 2023.2.2, and it is the same). It is just a thin underline of the color same as code. We do not mean it is an issue.
If you do not desire such highlighting, you are free to disable it:

If there is anything else I can assist you with or you have any questions, please tell me.
“Since when is mutability of variables an issue that needs to be marked? I mean, variability is literally in their name, the variables.”
It's a great feature. It's basically an alternative to readonly variables, which we can't have in C# yet. I use a dark theme with regular local variables as grey, and mutated variables as bold white. (Rider default seems to be to underline them.)
Then any set-once variables will look normal, and and set-twice+ variables will be marked bold white, and you will immediately see which variables mutate. You can reorganize your method to minimize or eliminate the mutated variables, or if you have an iteration variable, then it is highlighted as the one variable that changes its state.