{"record":{"id":"b44bcc0b90f4ac2e","repo":"dotnet/wpf","slug":"e-notimpl-bindregion-is-not-implemented","errorCode":"E_NOTIMPL","errorMessage":"BindRegion is not implemented.","messagePattern":"BindRegion is not implemented\\.","errorType":"exception","errorClass":"NotImplementedException","httpStatus":null,"severity":"info","filePath":"src/Microsoft.DotNet.Wpf/src/PresentationFramework/MS/Internal/IO/Packaging/indexingfiltermarshaler.cs","lineNumber":326,"sourceCode":"        /// </summary>\n        /// <returns>newly allocated PROPVARIANT structure</returns>\n        public IntPtr GetValue()\n        {\n            return MarshalPropVariant(_implementation.GetValue());\n        }\n\n        /// <summary>\n        /// BindRegion\n        /// </summary>\n        /// <param name=\"origPos\"></param>\n        /// <param name=\"riid\"></param>\n        /// <remarks>\n        /// The MSDN specification requires this function to return E_NOTIMPL for the time being.\n        /// </remarks>\n        public IntPtr BindRegion(FILTERREGION origPos, ref Guid riid)\n        {\n            // The following exception maps to E_NOTIMPL.\n            throw new NotImplementedException(SR.FilterBindRegionNotImplemented);\n        }\n        #endregion IFilter implementation\n\n        #region Properties\n\n        /// <summary>\n        /// If set to true, FILTER_E_END_OF_CHUNKS exception is thrown\n        /// by IFilter.GetChunk() on end of chunks. \n        /// If false, a STAT_CHUNK with idChunk as 0 is returned instead.\n        /// </summary>\n        internal bool ThrowOnEndOfChunks\n        {\n            get\n            {\n                return _throwOnEndOfChunks;\n            }\n\n            set","sourceCodeStart":308,"sourceCodeEnd":344,"githubUrl":"https://github.com/dotnet/wpf/blob/81131a70a4c573cd62748a5c36908fc4d662daa9/src/Microsoft.DotNet.Wpf/src/PresentationFramework/MS/Internal/IO/Packaging/indexingfiltermarshaler.cs#L308-L344","documentation":"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.","triggerScenarios":"Any call to BindRegion on the WPF filter implementation — always, by design, regardless of arguments (FILTERREGION origPos, Guid riid).","commonSituations":"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.","solutions":["Do not call BindRegion against WPF's filter; use GetChunk/GetText/GetValue chunk positioning instead","Handle E_NOTIMPL (or the NotImplementedException) host-side as an expected, non-fatal result","If region binding is genuinely required, provide your own IFilter implementation rather than using IndexingFilterMarshaler"],"exampleFix":"// before: assuming BindRegion works\nvar moniker = filter.BindRegion(origPos, ref iid);\n\n// after: skip region binding; it is E_NOTIMPL by spec for this filter\n// rely on chunk ids/attributes from GetChunk for positioning instead","handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"try\n{\n    filter.BindRegion(origPos, ref riid);\n}\ncatch (NotImplementedException)\n{\n    // expected: BindRegion returns E_NOTIMPL per the IFilter spec for this filter\n}","preventionTips":["Do not call BindRegion on WPF's filter; use chunk-based positioning (GetChunk/GetText/GetValue)","Handle E_NOTIMPL as a benign, documented result in any generic IFilter host code","Implement your own IFilter only if region binding is a hard requirement"],"tags":["wpf","com-interop","ifilter","not-implemented"],"backgroundTag":"method-not-implemented","analyzedSha":"81131a70a4c573cd62748a5c36908fc4d662daa9","analyzedAt":"2026-09-14T10:12:48.479Z","contentChangedAt":"2026-09-14T10:12:48.479Z","schemaVersion":2},"datasetVersion":"2026-09-21T21:30:21.729Z"}