无法在最佳段落格式化过程中重新输入文本格式化引擎。

E次奥 2018-01-25 06:33:39
RT; WPF程序;

RichTextBox 输入的过程中突然出现的异常,搞不懂是什么情况???

求帮助!
...全文
436 2 打赏 收藏 转发到动态 举报
写回复
用AI写文章
2 条回复
切换为时间正序
请发表友善的回复…
发表回复
E次奥 2018-03-27
  • 打赏
  • 举报
回复
引用 1 楼 caozhy 的回复:
你要是用英文版vs,错误提示直接google就能解决了,你这中文的错误提示,鬼知道了。
我找到了错误的源码,但是不知道怎么解决?
 /// <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;
        }
 
这个是微软的代码
threenewbee 2018-01-25
  • 打赏
  • 举报
回复
你要是用英文版vs,错误提示直接google就能解决了,你这中文的错误提示,鬼知道了。

110,537

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术 C#
社区管理员
  • C#
  • Web++
  • by_封爱
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

让您成为最强悍的C#开发者

试试用AI创作助手写篇文章吧