dotnet/wpf · error · COMException

0x80041705

0x80041705

Error message

GetText operation is not supported on current chunk.

What it means

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).

Solutions

  1. Use GetValue() to obtain the property value for chunks from this filter.
  2. Inspect CHUNKSTATE/chunk flags and only call GetText for CHUNK_TEXT chunks.
  3. Catch COMException with HResult 0x80041705 and skip text extraction for such chunks.

Example fix

// before
filter.GetText(ref len, ptr);
// after
if (chunk.flags == CHUNKSTATE.CHUNK_VALUE)
    value = filter.GetValue();
else
    filter.GetText(ref len, ptr);
Defensive patterns

Strategy: type-guard

Validate before calling

bool canGetText = (chunk.flags & CHUNKSTATE.CHUNK_TEXT) != 0;

Type guard

static bool IsTextChunk(FILTERCHUNK c) => c.flags == CHUNKSTATE.CHUNK_TEXT;

Try / catch

try { filter.GetText(ref len, ptr); } catch (COMException ex) when (ex.HResult == unchecked((int)0x80041705)) { /* no text for this chunk */ }

Prevention

When it happens

Trigger: An IFilter host calls GetText(ref uint, IntPtr) on a chunk from EncryptedPackageFilter instead of GetValue.

Common situations: Indexing XPS/encrypted OOXML packages with a custom filter host; generic IFilter consumers that always request text for every chunk.

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


AI-assisted analysis of dotnet/wpf@81131a70a4 (2026-09-14). Data as JSON: /api/errors/947af63dd3114651. Report an issue: GitHub.

Appendix: source

Thrown at src/Microsoft.DotNet.Wpf/src/PresentationFramework/MS/Internal/IO/Packaging/EncryptedPackageFilter.cs:82

        /// <summary>
        /// Returns description of the next chunk.
        /// </summary>
        /// <returns>Chunk descriptor</returns>
        public STAT_CHUNK GetChunk()
        {
            return _filter.GetChunk();
        }

        /// <summary>
        /// Gets text content corresponding to current chunk.
        /// </summary>
        /// <param name="bufCharacterCount"></param>
        /// <param name="pBuffer"></param>
        /// <remarks>Not supported in indexing of core properties.</remarks>
        public void GetText(ref uint bufCharacterCount, IntPtr pBuffer)
        {
            throw new COMException(SR.FilterGetTextNotSupported,
                (int)FilterErrorCode.FILTER_E_NO_TEXT);
        }

        /// <summary>
        /// Gets the property value corresponding to current chunk.
        /// </summary>
        /// <returns>property value</returns>
        public IntPtr GetValue()
        {
            return _filter.GetValue();
        }

        /// <summary>
        /// Retrieves an interface representing the specified portion of the object.
        /// </summary>
        /// <param name="origPos"></param>
        /// <param name="riid"></param>
        /// <returns>Not implemented. Reserved for future use.</returns>

View on GitHub (pinned to 81131a70a4)