{"record":{"id":"9541816a7285484d","repo":"dotnet/wpf","slug":"not-implemented","errorCode":null,"errorMessage":"Not implemented.","messagePattern":"Not implemented\\.","errorType":"exception","errorClass":"NotImplementedException","httpStatus":null,"severity":"error","filePath":"src/Microsoft.DotNet.Wpf/src/PresentationFramework/System/Windows/Documents/DocumentSequenceTextContainer.cs","lineNumber":102,"sourceCode":"                if (this.Changed != null && !skipEvents)\n                {\n                    Changed(this, changes);\n                }\n            }\n        }\n\n        // Allocate a new ITextPointer at the specified offset.\n        // Equivalent to this.Start.CreatePointer(offset), but does not\n        // necessarily allocate this.Start.\n        ITextPointer ITextContainer.CreatePointerAtOffset(int offset, LogicalDirection direction)\n        {\n            return ((ITextContainer)this).Start.CreatePointer(offset, direction);\n        }\n\n        // Not Implemented.\n        ITextPointer ITextContainer.CreatePointerAtCharOffset(int charOffset, LogicalDirection direction)\n        {\n            throw new NotImplementedException();\n        }\n\n        ITextPointer ITextContainer.CreateDynamicTextPointer(StaticTextPointer position, LogicalDirection direction)\n        {\n            return ((ITextPointer)position.Handle0).CreatePointer(direction);\n        }\n\n        StaticTextPointer ITextContainer.CreateStaticPointerAtOffset(int offset)\n        {\n            return new StaticTextPointer(this, ((ITextContainer)this).CreatePointerAtOffset(offset, LogicalDirection.Forward));\n        }\n\n        TextPointerContext ITextContainer.GetPointerContext(StaticTextPointer pointer, LogicalDirection direction)\n        {\n            return ((ITextPointer)pointer.Handle0).GetPointerContext(direction);\n        }\n\n        int ITextContainer.GetOffsetToPosition(StaticTextPointer position1, StaticTextPointer position2)","sourceCodeStart":84,"sourceCodeEnd":120,"githubUrl":"https://github.com/dotnet/wpf/blob/81131a70a4c573cd62748a5c36908fc4d662daa9/src/Microsoft.DotNet.Wpf/src/PresentationFramework/System/Windows/Documents/DocumentSequenceTextContainer.cs#L84-L120","documentation":"DocumentSequenceTextContainer implements ITextContainer for interop with the text editing stack, but char-offset-based pointer creation is not meaningful for a document sequence (which composes multiple child documents). The explicit interface implementation CreatePointerAtCharOffset unconditionally throws NotImplementedException.","triggerScenarios":"Calling ITextContainer.CreatePointerAtCharOffset on a DocumentSequenceTextContainer, e.g. via text editor or selection code that uses char-offset navigation across a FixedDocumentSequence.","commonSituations":"Text editing frameworks (TextEditor, selection services) attempting char-offset addressing on a DocumentSequence; custom code casting the container to ITextContainer and calling char-offset APIs.","solutions":["Do not call CreatePointerAtCharOffset on DocumentSequenceTextContainer; use CreatePointerAtPosition or pointer-based navigation instead","Obtain a pointer via the container's Start/End properties and move relatively","If char-offset logic is required, operate on the individual child document's TextContainer instead of the sequence's"],"exampleFix":"// before\nvar ptr = ((ITextContainer)seqTextContainer).CreatePointerAtCharOffset(offset, LogicalDirection.Forward);\n// after\nvar ptr = ((ITextContainer)seqTextContainer).Start.CreatePointer(LogicalDirection.Forward);\nptr.MoveToPosition(targetPosition);","handlingStrategy":"type-guard","validationCode":"if (((ITextContainer)container) is DocumentSequenceTextContainer)\n    throw new NotSupportedException(\"CreatePointerAtCharOffset is not supported on document sequences\");","typeGuard":"bool SupportsCharOffsetPointer(ITextContainer c) => c is not DocumentSequenceTextContainer;","tryCatchPattern":"try { ptr = ((ITextContainer)c).CreatePointerAtCharOffset(off, dir); }\ncatch (NotImplementedException) { ptr = ((ITextContainer)c).Start.CreatePointer(dir); }","preventionTips":["Use pointer-based (not char-offset) navigation on DocumentSequence containers","Check container type before calling ITextContainer advanced APIs","Operate on child document containers when char offsets are required"],"tags":["wpf","documents","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-22T01:17:13.364Z"}