dotnet/wpf · error · COMException

0x8004170C

0x8004170C

Error message

<dynamic: xmlException.Message>

What it means

COMException from XamlFilter.GetChunk: the underlying XmlReader threw an XmlException while reading the XAML content (ill-formed document). The filter closes its reader and rethrows with the original XML message text and FILTER_E_UNKNOWNFORMAT so the indexer treats the document as an unknown format.

Solutions

  1. Fix the malformed XAML in the source document so it parses
  2. Skip or exclude the invalid document from indexing by catching the COMException and returning FILTER_E_UNKNOWNFORMAT
Defensive patterns

Strategy: try-catch

When it happens

Trigger: Thrown at src/Microsoft.DotNet.Wpf/src/PresentationFramework/MS/Internal/IO/Packaging/XamlFilter.cs:242 when the library encounters an invalid state.

Common situations: See trigger scenarios.


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

Appendix: source

Thrown at src/Microsoft.DotNet.Wpf/src/PresentationFramework/MS/Internal/IO/Packaging/XamlFilter.cs:242

            {
                //Ensure _xamlReader has been closed
                EnsureXmlReaderIsClosed();

                // End of chunks.
                return null;
            }

            try
            {
                contentUnit = NextContentUnit();
            }
            catch (XmlException xmlException)
            {
                //Ensure _xamlReader has been closed
                EnsureXmlReaderIsClosed();

                // Return FILTER_E_UNKNOWNFORMAT for ill-formed documents.
                throw new COMException(xmlException.Message, (int)FilterErrorCode.FILTER_E_UNKNOWNFORMAT);
            }

            if (contentUnit == null)
            {
                // Update text information.
                _currentContent = null;

                //Ensure _xamlReader has been closed
                EnsureXmlReaderIsClosed();

                // Report end of stream by indicating end of chunks.
                return null;
            }

            // Store the text for returning in GetText.
            _currentContent = contentUnit.Text;

            // Record the fact that GetText hasn't been called on this chunk.

View on GitHub (pinned to 81131a70a4)