在WPF程序中出现的错误,应该是RichTextBox出现的,但是我不知道怎么解决?
System.InvalidOperationException: 无法在最佳段落格式化过程中重新输入文本格式化引擎。
   在 MS.Internal.TextFormatting.TextFormatterImp.AcquireContext(Object owner, IntPtr ploc)
   在 MS.Internal.TextFormatting.TextMetrics.FullTextLine.FormatLine(FullTextState fullText, Int32 cpFirst, Int32 lineLength, Int32 formatWidth, Int32 finiteFormatWidth, Int32 paragraphWidth, LineFlags lineFlags, FormattedTextSymbols collapsingSymbol)
   在 MS.Internal.TextFormatting.TextMetrics.FullTextLine..ctor(FormatSettings settings, Int32 cpFirst, Int32 lineLength, Int32 paragraphWidth, LineFlags lineFlags)
   在 MS.Internal.TextFormatting.TextFormatterImp.FormatLineInternal(TextSource textSource, Int32 firstCharIndex, Int32 lineLength, Double paragraphWidth, TextParagraphProperties paragraphProperties, TextLineBreak previousLineBreak, TextRunCache textRunCache)
   在 MS.Internal.TextFormatting.TextFormatterImp.RecreateLine(TextSource textSource, Int32 firstCharIndex, Int32 lineLength, Double paragraphWidth, TextParagraphProperties paragraphProperties, TextLineBreak previousLineBreak, TextRunCache textRunCache)
   在 MS.Internal.PtsHost.Line.Format(FormattingContext ctx, Int32 dcp, Int32 width, Int32 trackWidth, TextParagraphProperties lineProps, TextLineBreak textLineBreak)
   在 MS.Internal.PtsHost.TextParagraph.FormatLineCore(Line line, IntPtr pbrLineIn, FormattingContext ctx, Int32 dcp, Int32 width, Int32 trackWidth, Boolean firstLine, Int32 dcpLine)
   在 MS.Internal.PtsHost.TextParaClient.InputHitTestCompositeLines(FSPOINT pt, FSTEXTDETAILSFULL& textDetails)
   在 MS.Internal.PtsHost.TextParaClient.InputHitTest(FSPOINT pt)
   在 MS.Internal.PtsHost.PtsHelper.InputHitTestParaList(PtsContext ptsContext, FSPOINT pt, FSRECT& rcTrack, FSPARADESCRIPTION[] arrayParaDesc)
   在 MS.Internal.PtsHost.ContainerParaClient.InputHitTest(FSPOINT pt)
   在 MS.Internal.PtsHost.PtsHelper.InputHitTestParaList(PtsContext ptsContext, FSPOINT pt, FSRECT& rcTrack, FSPARADESCRIPTION[] arrayParaDesc)
   在 MS.Internal.PtsHost.PtsHelper.InputHitTestTrack(PtsContext ptsContext, FSPOINT pt, FSTRACKDESCRIPTION& trackDesc)
   在 MS.Internal.PtsHost.PtsPage.InputHitTestPage(FSPOINT pt)
   在 MS.Internal.PtsHost.FlowDocumentPage.InputHitTestCore(Point point)
   在 MS.Internal.PtsHost.FlowDocumentPage.System.Windows.IContentHost.InputHitTest(Point point)
   在 MS.Internal.PtsHost.PageVisual.System.Windows.IContentHost.InputHitTest(Point point)
   在 System.Windows.UIElement.InputHitTest(Point pt, IInputElement& enabledHit, IInputElement& rawHit, HitTestResult& rawHitResult)
   在 System.Windows.UIElement.InputHitTest(Point point)
   在 Microsoft.Windows.Shell.WindowChromeWorker._HandleNCHitTest(WM uMsg, IntPtr wParam, IntPtr lParam, Boolean& handled)
   在 Microsoft.Windows.Shell.WindowChromeWorker._WndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
   在 System.Windows.Interop.HwndSource.PublicHooksFilterMessage(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
   在 MS.Win32.HwndWrapper.WndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
   在 MS.Win32.HwndSubclass.DispatcherCallbackOperation(Object o)
   在 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)

解决方案 »

  1.   

    无法在最佳段落格式化过程中重新输入文本格式化引擎
    -》正常使用richtextbox不会出现问题,lz在使用过程中应该有什么其它的操作导致的。
      

  2.   


    现在没法判断是哪段代码的问题,就是正常使用中会偶尔出现一次这个异常

    box里的内容格式都是什么样子的
      

  3.   

    有没有转换richtextbox中字符串的格式,encoding什么的代码行?
    现在没法判断是哪段代码的问题,就是正常使用中会偶尔出现一次这个异常
      

  4.   

    粘贴一段代码啊,真服了you,你光给异常,有卵用 上面都是内部异常
      

  5.   

    我也报错没有代码,新建一个cube...无论新建什么都行,鼠标点一下。就报错了