Skip to main content

RCS1252: Normalize usage of infinite loop

Properties​

PropertyValue
Default Severitydisabled by default
Minimum language version-

Examples​

Example #1​

.editorconfig
roslynator_infinite_loop_style = while
diagnostic.cs
for (; ; )
{
Foo();
}
fix.cs
while (true)
{
Foo();
}

Example #2​

.editorconfig
roslynator_infinite_loop_style = for
diagnostic.cs
while (true)
{
Foo();
}
fix.cs
for (; ; )
{
Foo();
}

Configuration​

info

Option roslynator_infinite_loop_style is required to be set for this analyzer to work.

.editorconfig
# Use 'for'/'while' statement as an infinite loop
roslynator_infinite_loop_style = for|while

Applies to​