dotnet/wpf · error · COMException

0x80041705

0x80041705

Error message

GetText operation is not supported on current chunk.

What it means

CorePropertiesFilter implements the legacy IFilter COM interface to let indexers read OPC core properties. Chunks it emits are property chunks only, so GetText always throws a COMException with FILTER_E_NO_TEXT (0x80041705) — text extraction is intentionally not supported for core properties.

Solutions

  1. Call GetValue() on the chunk to obtain the property value instead of GetText().
  2. Check the chunk's attributes (chunkType) before calling and only call GetText for text chunks (cChunkType == CHUNK_TEXT).
  3. Catch COMException with HResult 0x80041705 and treat it as 'no text available' rather than a fatal failure.

Example fix

// before
string text = filter.GetText(4096);
// after
if (chunk.flags == CHUNKSTATE.CHUNK_VALUE)
{
    object value = filter.GetValue();
}
else
{
    string text = filter.GetText(4096);
}
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 { text = filter.GetText(len); } catch (COMException ex) when (ex.HResult == unchecked((int)0x80041705)) { text = null; }

Prevention

When it happens

Trigger: An IFilter consumer (indexer or custom code) calls GetText on the current chunk returned by CorePropertiesFilter.GetChunk instead of calling GetValue.

Common situations: Writing a search indexer over XPS/OPC documents; porting native IFilter host code that assumes all chunks have text; using Windows Search SDK against document core-properties chunks.

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/03a0c0020a06ac2e. Report an issue: GitHub.

Appendix: source

Thrown at src/Microsoft.DotNet.Wpf/src/PresentationFramework/MS/Internal/IO/Packaging/CorePropertiesFilter.cs:129

                CorePropertyEnumerator.CurrentPropId
                );

            // GetValue() call pending from this point on
            // for the current GetChunk call.
            _pendingGetValue = true;

            return chunk;
        }

        /// <summary>
        /// Gets text content corresponding to current chunk.
        /// </summary>
        /// <param name="bufferCharacterCount"></param>
        /// <returns></returns>
        /// <remarks>Not supported in indexing of core properties.</remarks>
        public string GetText(int bufferCharacterCount)
        {
            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 object GetValue()
        {
            // If GetValue() is already called for current chunk,
            // return error with FILTER_E_NO_MORE_VALUES.
            if (!_pendingGetValue)
            {
                throw new COMException(SR.FilterGetValueAlreadyCalledOnCurrentChunk,
                    (int)FilterErrorCode.FILTER_E_NO_MORE_VALUES);
            }

            // No GetValue() call pending from this point on

View on GitHub (pinned to 81131a70a4)