Telerik UI for UWP

BUG OF THE MONTH | An unconditional break

V3020 An unconditional ‘break’ within a loop. NodePool.cs 189

public IEnumerable<KeyValuePair<int, List<T>>>
  foreach (var item in this.generatedContainers)
    foreach (var pair in item.Value)
      if (!pair.IsFrozen)
        yield return item;

The break statement is not part of the if statement. It will execute no matter what value is stored in pair.IsFrozen, so the foreach loop will iterate only once.

Please click here to see more bugs from this project.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.