JetBrains Rider 2026.1 Help

Code inspection: Iterator never returns

This inspection reports an iterator method or local function that has no reachable completion path. In practice, the iterator never reaches the end and never stops yielding because every execution path loops forever or otherwise cannot complete.

Example

IEnumerable<int> GetValues() { while (true) { yield return 1; } }
IEnumerable<int> GetValues(int count) { for (var i = 0; i < count; i++) { yield return 1; } }

Quick-fix

There is no dedicated quick-fix for this inspection. A typical correction is to add a reachable exit condition so the iterator can finish.

01 April 2026