{"record":{"id":"e12363c95b4d8637","repo":"dotnet/efcore","slug":"this-enumerator-cannot-be-reset-e12363","errorCode":null,"errorMessage":"This enumerator cannot be reset.","messagePattern":"This enumerator cannot be reset\\.","errorType":"exception","errorClass":"NotSupportedException","httpStatus":null,"severity":"error","filePath":"src/EFCore.Relational/Query/Internal/SplitQueryingEnumerable.cs","lineNumber":304,"sourceCode":"                if (_resultCoordinator != null)\n                {\n                    foreach (var dataReader in _resultCoordinator.DataReaders)\n                    {\n                        dataReader?.DataReader.Dispose();\n                    }\n\n                    _resultCoordinator.DataReaders.Clear();\n\n                    _resultCoordinator = null;\n                }\n\n                _dataReader = null;\n                _dbDataReader = null;\n            }\n        }\n\n        public void Reset()\n            => throw new NotSupportedException(CoreStrings.EnumerableResetNotSupported);\n    }\n\n    private sealed class AsyncEnumerator : IAsyncEnumerator<T>\n    {\n        private readonly RelationalQueryContext _relationalQueryContext;\n        private readonly RelationalCommandResolver _relationalCommandResolver;\n        private readonly IReadOnlyList<ReaderColumn?>? _readerColumns;\n        private readonly Func<QueryContext, DbDataReader, ResultContext, SplitQueryResultCoordinator, T> _shaper;\n        private readonly Func<QueryContext, IExecutionStrategy, SplitQueryResultCoordinator, Task>? _relatedDataLoaders;\n        private readonly Type _contextType;\n        private readonly IDiagnosticsLogger<DbLoggerCategory.Query> _queryLogger;\n        private readonly bool _standAloneStateManager;\n        private readonly bool _detailedErrorEnabled;\n        private readonly IConcurrencyDetector? _concurrencyDetector;\n        private readonly IExceptionDetector _exceptionDetector;\n        private readonly CancellationToken _cancellationToken;\n\n        private IRelationalCommand? _relationalCommand;","sourceCodeStart":286,"sourceCodeEnd":322,"githubUrl":"https://github.com/dotnet/efcore/blob/3a2006ef569de08368d59db5e1468aa8f407e4f8/src/EFCore.Relational/Query/Internal/SplitQueryingEnumerable.cs#L286-L322","documentation":"Thrown when calling Reset() on the IEnumerator<T> from a SplitQueryingEnumerable. Split query enumerators coordinate multiple DbDataReaders across separate round-trips and cannot be rewound; Reset() throws NotSupportedException per IEnumerator conventions.","triggerScenarios":"Calling .Reset() on the enumerator of a query using AsSplitQuery() or UseSplitQuery(). The enumerator manages a SplitQueryResultCoordinator with multiple data readers, making a rewind architecturally impossible.","commonSituations":"Third-party library, test harness, or data-binding infrastructure that generically calls Reset() on any IEnumerator. Attempting to replay split query results without re-executing.","solutions":["Do not call Reset(); re-execute the split query for fresh results.","Call ToList()/ToListAsync() to materialize before passing to code that may reset.","Switch to AsSingleQuery() if reset support is somehow required (though still unsupported).","Report the issue to the library/framework invoking Reset()."],"exampleFix":"// before\nusing var e = context.Blogs\n    .AsSplitQuery()\n    .Include(b => b.Posts)\n    .GetEnumerator();\ne.Reset(); // throws\n\n// after\nvar blogs = context.Blogs\n    .AsSplitQuery()\n    .Include(b => b.Posts)\n    .ToList();","handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":["Never call Reset() on split-query enumerators — they coordinate multiple data readers.","Materialize with ToList()/ToListAsync() before passing results to external code.","Use single-query mode if you need simpler enumeration semantics (though Reset is still unsupported)."],"tags":["enumerator","reset","split-query","forward-only"],"backgroundTag":null,"analyzedSha":"3a2006ef569de08368d59db5e1468aa8f407e4f8","analyzedAt":"2026-08-11T23:42:04.146Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}