{"record":{"id":"947af63dd3114651","repo":"dotnet/wpf","slug":"0x80041705-gettext-operation-is-not-supported-on-current","errorCode":"0x80041705","errorMessage":"GetText operation is not supported on current chunk.","messagePattern":"GetText operation is not supported on current chunk\\.","errorType":"error_code","errorClass":"COMException","httpStatus":null,"severity":"error","filePath":"src/Microsoft.DotNet.Wpf/src/PresentationFramework/MS/Internal/IO/Packaging/EncryptedPackageFilter.cs","lineNumber":82,"sourceCode":"\n        /// <summary>\n        /// Returns description of the next chunk.\n        /// </summary>\n        /// <returns>Chunk descriptor</returns>\n        public STAT_CHUNK GetChunk()\n        {\n            return _filter.GetChunk();\n        }\n\n        /// <summary>\n        /// Gets text content corresponding to current chunk.\n        /// </summary>\n        /// <param name=\"bufCharacterCount\"></param>\n        /// <param name=\"pBuffer\"></param>\n        /// <remarks>Not supported in indexing of core properties.</remarks>\n        public void GetText(ref uint bufCharacterCount, IntPtr pBuffer)\n        {\n            throw new COMException(SR.FilterGetTextNotSupported,\n                (int)FilterErrorCode.FILTER_E_NO_TEXT);\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            return _filter.GetValue();\n        }\n\n        /// <summary>\n        /// Retrieves an interface representing the specified portion of the object.\n        /// </summary>\n        /// <param name=\"origPos\"></param>\n        /// <param name=\"riid\"></param>\n        /// <returns>Not implemented. Reserved for future use.</returns>","sourceCodeStart":64,"sourceCodeEnd":100,"githubUrl":"https://github.com/dotnet/wpf/blob/81131a70a4c573cd62748a5c36908fc4d662daa9/src/Microsoft.DotNet.Wpf/src/PresentationFramework/MS/Internal/IO/Packaging/EncryptedPackageFilter.cs#L64-L100","documentation":"EncryptedPackageFilter implements the native IFilter COM interface for encrypted package entries. Like CorePropertiesFilter, its chunks are property-only, so GetText unconditionally throws a COMException with FILTER_E_NO_TEXT (0x80041705).","triggerScenarios":"An IFilter host calls GetText(ref uint, IntPtr) on a chunk from EncryptedPackageFilter instead of GetValue.","commonSituations":"Indexing XPS/encrypted OOXML packages with a custom filter host; generic IFilter consumers that always request text for every chunk.","solutions":["Use GetValue() to obtain the property value for chunks from this filter.","Inspect CHUNKSTATE/chunk flags and only call GetText for CHUNK_TEXT chunks.","Catch COMException with HResult 0x80041705 and skip text extraction for such chunks."],"exampleFix":"// before\nfilter.GetText(ref len, ptr);\n// after\nif (chunk.flags == CHUNKSTATE.CHUNK_VALUE)\n    value = filter.GetValue();\nelse\n    filter.GetText(ref len, ptr);","handlingStrategy":"type-guard","validationCode":"bool canGetText = (chunk.flags & CHUNKSTATE.CHUNK_TEXT) != 0;","typeGuard":"static bool IsTextChunk(FILTERCHUNK c) => c.flags == CHUNKSTATE.CHUNK_TEXT;","tryCatchPattern":"try { filter.GetText(ref len, ptr); } catch (COMException ex) when (ex.HResult == unchecked((int)0x80041705)) { /* no text for this chunk */ }","preventionTips":["Only call GetText on CHUNK_TEXT chunks","Use GetValue for encrypted-package property chunks","Handle FILTER_E_NO_TEXT gracefully in generic IFilter hosts"],"tags":["com","ifilter","indexing","unsupported-operation"],"backgroundTag":"unsupported-operation","analyzedSha":"81131a70a4c573cd62748a5c36908fc4d662daa9","analyzedAt":"2026-09-14T10:12:48.479Z","contentChangedAt":"2026-09-14T10:12:48.479Z","schemaVersion":2},"datasetVersion":"2026-09-22T01:17:13.364Z"}