{"record":{"id":"ed2fce33574fa8e8","repo":"dotnet/wpf","slug":"0x80041706","errorCode":"0x80041706","errorMessage":"GetValue operation is not supported on current chunk.","messagePattern":"GetValue operation is not supported on current chunk\\.","errorType":"error_code","errorClass":"COMException","httpStatus":null,"severity":"warning","filePath":"src/Microsoft.DotNet.Wpf/src/PresentationFramework/MS/Internal/IO/Packaging/PackageFilter.cs","lineNumber":241,"sourceCode":"        {\n            if (_progress != Progress.FilteringContent)\n            {\n                throw new COMException(SR.FilterGetTextNotSupported, \n                    (int)FilterErrorCode.FILTER_E_NO_TEXT);\n            }\n\n            _currentFilter.GetText(ref bufferCharacterCount, pBuffer);\n        }\n\n        /// <summary>\n        /// Gets the property value corresponding to current chunk.\n        /// </summary>\n        /// <returns>Property value</returns>\n        public IntPtr GetValue()\n        {\n            if (_progress != Progress.FilteringCoreProperties)\n            {\n                throw new COMException(SR.FilterGetValueNotSupported,\n                    (int)FilterErrorCode.FILTER_E_NO_VALUES);\n            }\n\n            return _currentFilter.GetValue();\n        }\n\n        /// <summary>\n        /// BindRegion\n        /// </summary>\n        /// <param name=\"origPos\"></param>\n        /// <param name=\"riid\"></param>\n        /// <remarks>\n        /// The MSDN specification requires this function to return E_NOTIMPL for the time being.\n        /// </remarks>\n        public IntPtr BindRegion(FILTERREGION origPos, ref Guid riid)\n        {\n            throw new NotImplementedException(SR.FilterBindRegionNotImplemented);\n        }","sourceCodeStart":223,"sourceCodeEnd":259,"githubUrl":"https://github.com/dotnet/wpf/blob/81131a70a4c573cd62748a5c36908fc4d662daa9/src/Microsoft.DotNet.Wpf/src/PresentationFramework/MS/Internal/IO/Packaging/PackageFilter.cs#L223-L259","documentation":"Mirror of GetText: IFilter chunks carry either text or values. PackageFilter.GetValue only works while the current chunk is a core-properties chunk (Progress.FilteringCoreProperties); otherwise it throws FILTER_E_NO_VALUES (0x80041706) as a COMException, meaning the current chunk has no property value to retrieve.","triggerScenarios":"Calling GetValue() while the current chunk is a plain text/content chunk, or before GetChunk has produced a core-properties chunk.","commonSituations":"Indexers extracting document metadata (title, author, keywords) that call GetValue on every chunk rather than only on property chunks.","solutions":["Call GetValue only for core-properties chunks; inspect the chunk attributes returned by GetChunk first.","Use GetText for content chunks and GetValue for property chunks, branching on chunk type.","Catch COMException with HResult 0x80041706 and skip value extraction for that chunk."],"exampleFix":"// before\nfilter.GetChunk(out chunk);\nIntPtr val = filter.GetValue(); // throws on text chunks\n// after\nfilter.GetChunk(out chunk);\nif (chunk.flags == CHUNKSTATE.CHUNK_VALUE)\n    IntPtr val = filter.GetValue();\nelse\n    filter.GetText(ref bufCount, pBuffer); // content chunk","handlingStrategy":"type-guard","validationCode":"// After GetChunk, only call GetValue for property chunks:\nbool canGetValue = (chunk.flags & CHUNKSTATE.CHUNK_VALUE) != 0;","typeGuard":"static bool IsValueChunk(System.Runtime.InteropServices.ComTypes.STAT_CHUNK c)\n    => (c.flags & System.Runtime.InteropServices.ComTypes.CHUNKSTATE.CHUNK_VALUE) != 0;","tryCatchPattern":"try { IntPtr v = filter.GetValue(); }\ncatch (COMException e) when (e.HResult == unchecked((int)0x80041706))\n{ /* FILTER_E_NO_VALUES: current chunk has no value — skip or call GetText */ }","preventionTips":["Extract metadata only from CHUNK_VALUE chunks identified via chunk attributes.","Never assume a chunk supports both GetText and GetValue — the IFilter protocol makes them mutually exclusive.","Wrap per-chunk extraction so one wrong-kind chunk does not abort the whole indexing pass."],"tags":["ifilter","indexing","wrong-chunk-type"],"backgroundTag":"unsupported-operation","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"}