Total .NET Analyzer Rule Documentation  

EmptyDo Rule

Review empty Do statements.

Remarks

Do statements execute a statement or block of statements until a given expression evaluates to a given value (True or False). By having no code in a Do statement, you are not executing any code in the loop.

For instance, the following code has an empty Do statement:


' VB
Do While counter > 10

Loop

//C#
do
{

}
while counter > 10;



In general, empty Do statements do not serve a purpose, and can often lead to endless loops.

Resolution

Review empty Do statements to determine whether they represent undone work, contain commented code that should be enabled, or do nothing and should be removed.

See Also

Do Statements (VB)

Do Statements (C#)