dotnet/wpf · info · NotImplementedException

E_NOTIMPL

E_NOTIMPL

Error message

BindRegion is not implemented.

What it means

XpsFilter intentionally does not implement IFilter.BindRegion; calling it always throws NotImplementedException, which COM interop maps to E_NOTIMPL. BindRegion is reserved for moniker-based linking and is not meaningful for XPS package filtering.

Solutions

  1. Do not call BindRegion on XpsFilter — treat E_NOTIMPL as 'not supported' and continue
  2. Gate generic IFilter code so BindRegion is only invoked on filters that advertise support
  3. Handle NotImplementedException/E_NOTIMPL gracefully in indexing loops

Example fix

// before
var result = ((IFilter)filter).BindRegion(origPos, ref riid);
// after
try { result = ((IFilter)filter).BindRegion(origPos, ref riid); }
catch (NotImplementedException) { /* not supported — proceed without binding */ }
Defensive patterns

Strategy: try-catch

Try / catch

try { filter.BindRegion(origPos, ref riid); }
catch (NotImplementedException) { /* expected: XpsFilter never supports BindRegion */ }

Prevention

When it happens

Trigger: Any call to IFilter.BindRegion on an XpsFilter instance, e.g. by indexers attempting to bind a FILTERREGION to an interface.

Common situations: Search/index infrastructure that generically calls all IFilter methods, or code ported from filters that support BindRegion.

Related errors


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

Appendix: source

Thrown at src/Microsoft.DotNet.Wpf/src/PresentationFramework/MS/Internal/IO/Packaging/XpsFilter.cs:291

            if (_filter == null)
            {
                throw new COMException(SR.FileToFilterNotLoaded,
                    (int)FilterErrorCode.FILTER_E_ACCESS);
            }

            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>
        IntPtr IFilter.BindRegion([In] FILTERREGION origPos, [In] ref Guid riid)
        {
            // The following exception maps to E_NOTIMPL.
            throw new NotImplementedException(SR.FilterBindRegionNotImplemented);
        }

        #endregion IFilter methods

        #region IPersistFile methods

        /// <summary>
        /// Return the CLSID for the XAML filtering component.
        /// </summary>
        /// <param name="pClassID">On successful return, a reference to the CLSID.</param>
        void IPersistFile.GetClassID(out Guid pClassID)
        {
            pClassID = _filterClsid;
        }

        /// <summary>
        /// Return the path to the current working file or the file prompt ("*.xps").
        /// </summary>

View on GitHub (pinned to 81131a70a4)