dotnet/wpf · warning · COMException
0x80041705
0x80041705
Error message
GetText operation is not supported on current chunk.
What it means
In the IFilter protocol, a chunk carries either text or property values, never both. PackageFilter.GetText only works while the current chunk is a content (text) chunk (Progress.FilteringContent); otherwise it throws FILTER_E_NO_TEXT (0x80041705) as a COMException, indicating GetText is not valid for the chunk you are on.
Solutions
- Only call GetText when the current chunk represents text content; check the chunk attributes (CHUNKSTATE) returned by GetChunk before calling.
- Call GetValue() instead when the chunk is a core-properties chunk.
- Catch COMException with HResult 0x80041705 and skip text extraction for that chunk, continuing with the next.
Example fix
// before
filter.GetChunk(out chunk);
filter.GetText(ref bufCount, pBuffer); // throws on property chunks
// after
filter.GetChunk(out chunk);
if (chunk.flags == CHUNKSTATE.CHUNK_TEXT)
filter.GetText(ref bufCount, pBuffer);
else
IntPtr v = filter.GetValue(); // property chunk Defensive patterns
Strategy: type-guard
Validate before calling
// After GetChunk, only call GetText for content (text) chunks: bool canGetText = (chunk.flags & CHUNKSTATE.CHUNK_TEXT) != 0;
Type guard
static bool IsTextChunk(System.Runtime.InteropServices.ComTypes.STAT_CHUNK c)
=> (c.flags & System.Runtime.InteropServices.ComTypes.CHUNKSTATE.CHUNK_TEXT) != 0; Try / catch
try { filter.GetText(ref bufCount, pBuffer); }
catch (COMException e) when (e.HResult == unchecked((int)0x80041705))
{ /* FILTER_E_NO_TEXT: current chunk has no text — skip or call GetValue */ } Prevention
- Branch on the chunk's CHUNKSTATE attributes returned by GetChunk before extracting.
- Call GetText only for CHUNK_TEXT chunks and GetValue only for CHUNK_VALUE chunks.
- Keep filter state (current chunk kind) explicit in your indexer loop.
When it happens
Trigger: Calling GetText while the current chunk is a core-properties chunk (or before any chunk has been fetched / after chunks are exhausted), i.e. whenever _progress != Progress.FilteringContent.
Common situations: Indexers that call GetText unconditionally on every chunk instead of checking the chunk's attributes/flags; core-property chunks carry values, so GetText fails on them.
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/d58dff7b87507c5c.
Report an issue: GitHub.
Appendix: source
Thrown at src/Microsoft.DotNet.Wpf/src/PresentationFramework/MS/Internal/IO/Packaging/PackageFilter.cs:226
//
// No more filters. Filtering completed.
// Throw FILTER_E_END_OF_CHUNKS exception.
//
throw new COMException(SR.FilterEndOfChunks,
(int)FilterErrorCode.FILTER_E_END_OF_CHUNKS);
}
}
}
/// <summary>
/// Gets text content corresponding to current chunk.
/// </summary>
public void GetText(ref uint bufferCharacterCount, IntPtr pBuffer)
{
if (_progress != Progress.FilteringContent)
{
throw new COMException(SR.FilterGetTextNotSupported,
(int)FilterErrorCode.FILTER_E_NO_TEXT);
}
_currentFilter.GetText(ref bufferCharacterCount, pBuffer);
}
/// <summary>
/// Gets the property value corresponding to current chunk.
/// </summary>
/// <returns>Property value</returns>
public IntPtr GetValue()
{
if (_progress != Progress.FilteringCoreProperties)
{
throw new COMException(SR.FilterGetValueNotSupported,
(int)FilterErrorCode.FILTER_E_NO_VALUES);
}
View on GitHub (pinned to 81131a70a4)