InvalidOperationException: A highlighting span matched 0 characters, which would cause an endless loop. Change the highlighting definition so that either the start or the end regex matches at least one character. Start regex: (?<=(?<=([^\\]|^)(\\\\)*)~\|)(?!.*(?<=([^\\]|^)(\\\\)*)~\|\|\|) End regex: ($|$ ) StackTrace: 在 ICSharpCode.AvalonEdit.Highlighting.HighlightingEngine.HighlightLineInternal() 在 ICSharpCode.AvalonEdit.Highlighting.HighlightingEngine.HighlightLine(IDocument document, IDocumentLine line) 在 ICSharpCode.AvalonEdit.Highlighting.DocumentHighlighter.HighlightLine(Int32 lineNumber) 在 ICSharpCode.AvalonEdit.Highlighting.HighlightingColorizer.ColorizeLine(DocumentLine line) 在 ICSharpCode.AvalonEdit.Rendering.DocumentColorizingTransformer.Colorize(ITextRunConstructionContext context) 在 ICSharpCode.AvalonEdit.Highlighting.HighlightingColorizer.Colorize(ITextRunConstructionContext context) 在 ICSharpCode.AvalonEdit.Rendering.ColorizingTransformer.Transform(ITextRunConstructionContext context, IList`1 elements) 在 ICSharpCode.AvalonEdit.Rendering.VisualLine.RunTransformers(ITextRunConstructionContext context, IVisualLineTransformer[] transformers) 在 ICSharpCode.AvalonEdit.Rendering.TextView.BuildVisualLine(DocumentLine documentLine, TextRunProperties globalTextRunProperties, VisualLineTextParagraphProperties paragraphProperties, VisualLineElementGenerator[] elementGeneratorsArray, IVisualLineTransformer[] lineTransformersArray, Size availableSize) 在 ICSharpCode.AvalonEdit.Rendering.TextView.CreateAndMeasureVisualLines(Size availableSize) 在 ICSharpCode.AvalonEdit.Rendering.TextView.MeasureOverride(Size availableSize) 在 System.Windows.FrameworkElement.MeasureCore(Size availableSize) 在 System.Windows.UIElement.Measure(Size availableSize) 在 System.Windows.ContextLayoutManager.UpdateLayout() 在 System.Windows.ContextLayoutManager.UpdateLayoutCallback(Object arg) 在 System.Windows.Media.MediaContext.FireInvokeOnRenderCallbacks() 在 System.Windows.Media.MediaContext.RenderMessageHandlerCore(Object resizedCompositionTarget) 在 System.Windows.Media.MediaContext.RenderMessageHandler(Object resizedCompositionTarget) 在 System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs) 在 System.Windows.Threading.ExceptionWrapper.TryCatchWhen(Object source, Delegate callback, Object args, Int32 numArgs, Delegate catchHandler)