dotnet/reactive · error · NotSupportedException
Specified method is not supported.
Error message
Specified method is not supported.
What it means
Yielder<T> is a compiler-less iterator helper implementing IEnumerator<T>. IEnumerator.Reset is not supported by iterator-style enumerators, so Yielder.Reset unconditionally throws NotSupportedException ("Specified method is not supported.") — mirroring the behavior of C# compiler-generated iterators.
Solutions
- Get a fresh enumerator via GetEnumerator() (or re-invoke the operator) instead of calling Reset.
- Materialize the sequence (ToList/ToArray) if you need multiple passes.
- Restructure the consumer to a single forward-only pass.
- If you own the consuming framework, remove Reset-based reuse logic.
Example fix
// before e.Reset(); while (e.MoveNext()) Process(e.Current); // after foreach (var item in sequence) Process(item); // or sequence.GetEnumerator() again
Defensive patterns
Strategy: fallback
Try / catch
try { enumerator.Reset(); }
catch (NotSupportedException) { enumerator = sequence.GetEnumerator(); // fresh enumerator instead
} Prevention
- Treat all iterators as forward-only; never call Reset.
- Re-acquire enumerators or re-invoke operators for new passes.
- Materialize sequences that need multiple traversals.
- Update legacy enumeration code that assumed Reset works.
When it happens
Trigger: Calling `Reset()` on an enumerator produced by a Yielder-backed operator, e.g. legacy code that assumed enumerators are restartable, or code doing `enumerator.Reset(); enumerator.MoveNext()` to replay a sequence.
Common situations: Porting .NET 1.x-style enumeration code that relied on Reset, reusing an enumerator for a second pass over a LINQ/Ix sequence, or framework code that defensively calls Reset before reuse.
Understand the failure class
Background: UnsupportedOperationException and "is not supported" errors: when a library deliberately refuses a call — this error's family across 30 libraries.
Related errors
- Cannot access a disposed object. Object name: ''.
- Element no longer available in the buffer.
- Specified argument was out of the range of valid values…
- Specified argument was out of the range of valid values…
- Specified method is not supported.
AI-assisted analysis of dotnet/reactive@94b5d5ab91 (2026-09-15).
Data as JSON: /api/errors/d3b26b9ce8302920.
Report an issue: GitHub.
Appendix: source
Thrown at Ix.NET/Source/System.Interactive/System/Linq/Yielder.cs:75
public Yielder<T> GetEnumerator() => this;
public bool MoveNext()
{
if (!_running)
{
_running = true;
_create(this);
}
else
{
_hasValue = false;
_continuation!();
}
return !_stopped && _hasValue;
}
public void Reset() => throw new NotSupportedException();
}
}
View on GitHub (pinned to 94b5d5ab91)