{"record":{"id":"26997b6b80635288","repo":"dotnet/wpf","slug":"0x80041700","errorCode":"0x80041700","errorMessage":"Filter has no more chunks to return.","messagePattern":"Filter has no more chunks to return\\.","errorType":"error_code","errorClass":"COMException","httpStatus":null,"severity":"info","filePath":"src/Microsoft.DotNet.Wpf/src/PresentationFramework/MS/Internal/IO/Packaging/PackageFilter.cs","lineNumber":120,"sourceCode":"        /// Non-fatal exceptions from external filters, identified for all practical purposes\n        /// with COMException and IOException, are `swallowed by this method.\n        /// </para>\n        /// </remarks>\n        public STAT_CHUNK GetChunk()\n        {\n            //\n            // _progress is Progress.FilteringNotStarted initially and\n            // subsequently gets updated in MoveToNextFilter().\n            //\n\n            if (_progress == Progress.FilteringNotStarted)\n            {\n                MoveToNextFilter();\n            }\n\n            if (_progress == Progress.FilteringCompleted)\n            {\n                throw new COMException(SR.FilterEndOfChunks, \n                    (int)FilterErrorCode.FILTER_E_END_OF_CHUNKS);\n            }\n                \n            while(true)\n            {\n                try\n                {\n                    STAT_CHUNK chunk = _currentFilter.GetChunk();\n\n                    //\n                    // No exception raised. \n                    // If _currentFilter is internal filter,\n                    // this might be end of chunks if chunk.idChunk is 0. \n                    //\n\n                    if (!_isInternalFilter || chunk.idChunk != 0)\n                    {\n                        //","sourceCodeStart":102,"sourceCodeEnd":138,"githubUrl":"https://github.com/dotnet/wpf/blob/81131a70a4c573cd62748a5c36908fc4d662daa9/src/Microsoft.DotNet.Wpf/src/PresentationFramework/MS/Internal/IO/Packaging/PackageFilter.cs#L102-L138","documentation":"PackageFilter implements the Windows IFilter protocol over the parts of an XPS/OPC package. GetChunk iterates filters for each package part; once every filter has been exhausted (_progress == Progress.FilteringCompleted) the protocol-mandated result FILTER_E_END_OF_CHUNKS (0x80041700) is thrown as a COMException. This is a normal terminal signal, not a bug — it tells the caller indexing is complete.","triggerScenarios":"Calling GetChunk() after the last chunk of the package has already been returned, i.e. a subsequent iteration call when all parts of the package have been filtered.","commonSituations":"Search/indexing drivers (Windows Search, SQL full-text) that call GetChunk in a loop; the error is the documented stop condition — callers that treat it as a failure instead of loop termination get spurious errors.","solutions":["Treat HRESULT 0x80041700 (FILTER_E_END_OF_CHUNKS) as the end-of-enumeration sentinel and stop calling GetChunk, not as a failure.","Check COMException.HResult in the catch block and break the chunk loop on FILTER_E_END_OF_CHUNKS.","Consume every chunk (GetText/GetValue) before advancing so iteration state stays consistent."],"exampleFix":"// before\nwhile (true) { filter.GetChunk(out chunk); ProcessChunk(chunk); }\n// after\nwhile (true)\n{\n    try { filter.GetChunk(out chunk); }\n    catch (COMException e) when (e.HResult == unchecked((int)0x80041700)) { break; } // end of chunks\n    ProcessChunk(chunk);\n}","handlingStrategy":"try-catch","validationCode":"// Exhaustion is only discovered by calling GetChunk; track iteration state yourself:\nbool chunksRemaining = true;","typeGuard":null,"tryCatchPattern":"try { filter.GetChunk(out chunk); }\ncatch (COMException e) when (e.HResult == unchecked((int)0x80041700))\n{ /* FILTER_E_END_OF_CHUNKS: stop iterating — not an error */ }","preventionTips":["Always loop GetChunk until FILTER_E_END_OF_CHUNKS; never call it a fixed number of times.","Treat 0x80041700 as success/termination in indexer code paths.","Do not log end-of-chunks as an error to avoid noise in indexing pipelines."],"tags":["ifilter","indexing","end-of-enumeration"],"backgroundTag":"empty-result-set","analyzedSha":"81131a70a4c573cd62748a5c36908fc4d662daa9","analyzedAt":"2026-09-14T10:12:48.479Z","contentChangedAt":"2026-09-14T10:12:48.479Z","schemaVersion":2},"datasetVersion":"2026-09-21T21:30:21.729Z"}