AvaloniaUI/Avalonia · warning · InvalidOperationException

Enumeration has not started.

Error message

Enumeration has not started.

What it means

Centralized ThrowHelper.ThrowInvalidOperationException_InvalidOperation_EnumNotStarted throws InvalidOperationException "Enumeration has not started." It is the BCL-style helper for reading Current before MoveNext. In this Avalonia codebase it has no active call site (only the definition exists): PooledList's enumerator uses ThrowInvalidOperationException_InvalidOperation_EnumOpCantHappen (error 136) for its Current guard instead, and PooledStack's enumerator inlines its own message logic. So it is reserved/unreachable via the shipped enumerators.

Source

Thrown at src/Avalonia.Base/Collections/Pooled/ThrowHelper.cs:288

            throw new AggregateException(exceptions);
        }

        [DoesNotReturn]
        internal static void ThrowOutOfMemoryException()
        {
            throw new OutOfMemoryException();
        }

        [DoesNotReturn]
        internal static void ThrowArgumentException_Argument_InvalidArrayType()
        {
            throw new ArgumentException("Invalid array type.");
        }

        [DoesNotReturn]
        internal static void ThrowInvalidOperationException_InvalidOperation_EnumNotStarted()
        {
            throw new InvalidOperationException("Enumeration has not started.");
        }

        [DoesNotReturn]
        internal static void ThrowInvalidOperationException_InvalidOperation_EnumEnded()
        {
            throw new InvalidOperationException("Enumeration has ended.");
        }

        [DoesNotReturn]
        internal static void ThrowInvalidOperationException_EnumCurrent(int index)
        {
            throw GetInvalidOperationException_EnumCurrent(index);
        }

        [DoesNotReturn]
        internal static void ThrowInvalidOperationException_InvalidOperation_EnumFailedVersion()
        {
            throw new InvalidOperationException("Collection was modified during enumeration.");

View on GitHub (pinned to 11c5427268)

Solutions

  1. Unreachable via shipped enumerators — confirm you are not using a forked/custom enumerator.
  2. If you maintain such an enumerator, ensure Current is only read after MoveNext returns true.
  3. Prefer foreach, which enforces correct MoveNext/Current ordering automatically.
Defensive patterns

Strategy: validation

Validate before calling

// Unreachable via shipped enumerators. If you maintain a custom enumerator,
// only read Current after MoveNext returns true.

Prevention

When it happens

Trigger: Would be thrown by an enumerator's Current getter when the cursor is before the first element. No shipped PooledList/PooledStack enumerator routes to this exact helper today.

Common situations: Not reachable through public Avalonia enumerators; would only appear if a custom/internal enumerator wired to this helper were added.

Related errors


AI-assisted analysis of AvaloniaUI/Avalonia@11c5427268 (2026-08-13). Data as JSON: /api/errors/e11d110bf1b885b5. Report an issue: GitHub.