RT; WPF程序;RichTextBox 输入的过程中突然出现的异常,搞不懂是什么情况???求帮助!

解决方案 »

  1.   

    你要是用英文版vs,错误提示直接google就能解决了,你这中文的错误提示,鬼知道了。
      

  2.   


    我找到了错误的源码,但是不知道怎么解决? /// <summary>
            /// Acquire a free TextFormatter context for complex line operation
            /// </summary>
            /// <param name="owner">object that becomes the owner of LS context once acquired</param>
            /// <param name="ploc">matching PLOC</param>
            /// <returns>Active LS context</returns>
            /// <SecurityNotes>
            /// Critical - this sets the owner of the context
            /// Safe     - this doesn't expose critical info
            /// </SecurityNotes>
            [SecurityCritical, SecurityTreatAsSafe]
            internal TextFormatterContext AcquireContext(
                object      owner,
                IntPtr      ploc
                )
            {
                Invariant.Assert(owner != null);
     
                TextFormatterContext context = null;
     
                int c;
                int contextCount = _contextList.Count;
     
                for (c = 0; c < contextCount; c++)
                {
                    context = (TextFormatterContext)_contextList[c];
     
                    if (ploc == IntPtr.Zero)
                    {
                        if(context.Owner == null)
                            break;
                    }
                    else if (ploc == context.Ploc.Value)
                    {
                        // LS requires that we use the exact same context for line
                        // destruction or hittesting (part of the reason is that LS
                        // actually caches some run info in the context). So here
                        // we use the actual PLSC as the context signature so we
                        // locate the one we want.
     
                        Debug.Assert(context.Owner == null);
                        break;
                    }
                }
     
                if (c == contextCount)
                {
                    if (contextCount == 0 || !_multipleContextProhibited)
                    {
                        //  no free one exists, create a new one
                        context = new TextFormatterContext();
                        _contextList.Add(context);
                    }
                    else
                    {
                        // This instance of TextFormatter only allows a single context, reentering the
                        // same TextFormatter in this case is not allowed.
                        //
                        // This requirement is currently enforced only during optimal break computation.
                        // Client implementing nesting of optimal break content inside another must create
                        // a separate TextFormatter instance for each content in different nesting level.
                        throw new InvalidOperationException(SR.Get(SRID.TextFormatterReentranceProhibited));
                    }
                }
     
                Debug.Assert(context != null);
     
                context.Owner = owner;
                return context;
            }
     
    这个是微软的代码