
I am encountering an
ArgumentException: Specified Visual is already a child of another Visual or the root of a CompositionTarget.
when rendering an intra-text adornment in place of a collapsed region when the collapsed text is preceded by a tab character, but not if the collapsed text starts the line.
The feature I'm implementing replaces string matches with visual adornments. A menu command allows the user to select among the source string options, and their choice is inserted via IEditorDocument.ReplaceText where the TextRange is the current view's Selection.GetTextRanges. On a callback registered with the SyntaxEditor's DocumentTextChanged event, I remove all tags that intersect with the changed snapshot range before generating a new tag for each match.
My tagging setup closely adheres to the examples and tips in the documentation section. I have a CollapsedRegionTag that implements ICollapsedRegionTag and IIntraTextSpacerTag, a CollapsedRegionTagger that extends CollectionTagger<ICollapsedRegionTag> and implements ITagger<IIntraTextSpacerTag>, and a CollapsedRegionAdornmentManager that extends IntraTextAdornmentManagerBase<IEditorView, CollapsedRegionTag>.