dotnet/wpf · info · NotImplementedException

E_NOTIMPL

E_NOTIMPL

Error message

BindRegion is not implemented.

What it means

IFilter::BindRegion lets a host obtain a MONKER for a text region inside the document. WPF's IndexingFilterMarshaler intentionally never implements it — the MSDN specification itself requires returning E_NOTIMPL — so BindRegion always throws NotImplementedException, which the marshaler maps to the COM error E_NOTIMPL.

Solutions

  1. Do not call BindRegion against WPF's filter; use GetChunk/GetText/GetValue chunk positioning instead
  2. Handle E_NOTIMPL (or the NotImplementedException) host-side as an expected, non-fatal result
  3. If region binding is genuinely required, provide your own IFilter implementation rather than using IndexingFilterMarshaler

Example fix

// before: assuming BindRegion works
var moniker = filter.BindRegion(origPos, ref iid);

// after: skip region binding; it is E_NOTIMPL by spec for this filter
// rely on chunk ids/attributes from GetChunk for positioning instead
Defensive patterns

Strategy: try-catch

Try / catch

try
{
    filter.BindRegion(origPos, ref riid);
}
catch (NotImplementedException)
{
    // expected: BindRegion returns E_NOTIMPL per the IFilter spec for this filter
}

Prevention

When it happens

Trigger: Any call to BindRegion on the WPF filter implementation — always, by design, regardless of arguments (FILTERREGION origPos, Guid riid).

Common situations: Hosts that rely on BindRegion for fragment/region positioning (most indexers never call it); code ported from third-party filters that did implement BindRegion; probing code that walks the full IFilter surface in tests.

Related errors


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

Appendix: source

Thrown at src/Microsoft.DotNet.Wpf/src/PresentationFramework/MS/Internal/IO/Packaging/indexingfiltermarshaler.cs:326

        /// </summary>
        /// <returns>newly allocated PROPVARIANT structure</returns>
        public IntPtr GetValue()
        {
            return MarshalPropVariant(_implementation.GetValue());
        }

        /// <summary>
        /// BindRegion
        /// </summary>
        /// <param name="origPos"></param>
        /// <param name="riid"></param>
        /// <remarks>
        /// The MSDN specification requires this function to return E_NOTIMPL for the time being.
        /// </remarks>
        public IntPtr BindRegion(FILTERREGION origPos, ref Guid riid)
        {
            // The following exception maps to E_NOTIMPL.
            throw new NotImplementedException(SR.FilterBindRegionNotImplemented);
        }
        #endregion IFilter implementation

        #region Properties

        /// <summary>
        /// If set to true, FILTER_E_END_OF_CHUNKS exception is thrown
        /// by IFilter.GetChunk() on end of chunks. 
        /// If false, a STAT_CHUNK with idChunk as 0 is returned instead.
        /// </summary>
        internal bool ThrowOnEndOfChunks
        {
            get
            {
                return _throwOnEndOfChunks;
            }

            set

View on GitHub (pinned to 81131a70a4)