今天遇到一个超级bug, Textbox做了限制, 只能输入数字。 结果在搜狗输入法输入中文时导致崩溃, 出错信息如下:

未处理 System.InvalidOperationException
  Message=无法关闭撤消单元,因为不存在已打开的单元。

  Source=PresentationFramework
  StackTrace:
       在 MS.Internal.Documents.UndoManager.Close(IParentUndoUnit unit, UndoCloseAction closeAction)
       在 System.Windows.Documents.ImmComposition.CloseCompositionUndoUnit(UndoCloseAction undoCloseAction, ITextPointer compositionEnd)
       在 System.Windows.Documents.ImmComposition.UpdateCompositionText(FrameworkTextComposition composition, Int32 resultLength, Boolean includeResultText, ITextPointer& start, ITextPointer& end)
       在 System.Windows.Documents.ImmComposition.RaiseTextInputStartEvent(FrameworkTextComposition composition, Int32 resultLength, String compositionString)
       在 System.Windows.Documents.ImmComposition.OnWmImeChar(IntPtr wParam, Boolean& handled)
       在 System.Windows.Documents.ImmComposition.ImmCompositionFilterMessage(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)
       在 MS.Internal.Threading.ExceptionFilterHelper.TryCatchWhen(Object source, Delegate method, Object args, Int32 numArgs, Delegate catchHandler)
       在 System.Windows.Threading.Dispatcher.InvokeImpl(DispatcherPriority priority, TimeSpan timeout, Delegate method, Object args, Int32 numArgs)
       在 MS.Win32.HwndSubclass.SubclassWndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam)
       在 MS.Win32.UnsafeNativeMethods.CallWindowProc(IntPtr wndProc, IntPtr hWnd, Int32 msg, IntPtr wParam, IntPtr lParam)
       在 MS.Win32.HwndSubclass.DefWndProcWrapper(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam)
       在 MS.Win32.UnsafeNativeMethods.CallWindowProc(IntPtr wndProc, IntPtr hWnd, Int32 msg, IntPtr wParam, IntPtr lParam)
       在 MS.Win32.HwndSubclass.SubclassWndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam)
       在 MS.Win32.UnsafeNativeMethods.DispatchMessage(MSG& msg)
       在 System.Windows.Threading.Dispatcher.PushFrameImpl(DispatcherFrame frame)
       在 System.Windows.Threading.Dispatcher.PushFrame(DispatcherFrame frame)
       在 System.Windows.Application.RunDispatcher(Object ignore)
       在 System.Windows.Application.RunInternal(Window window)
       在 System.Windows.Application.Run(Window window)
       在 System.Windows.Application.Run()
       在 LiveChainCHIS_Client.App.Main() 位置 D:\项目\LiveChainCHIS-Client\LiveChainCHIS-Client\obj\x86\Debug\App.g.cs:行号 0
       在 System.AppDomain._nExecuteAssembly(RuntimeAssembly assembly, String[] args)
       在 System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)
       在 Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
       在 System.Threading.ThreadHelper.ThreadStart_Context(Object state)
       在 System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean ignoreSyncCtx)
       在 System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
       在 System.Threading.ThreadHelper.ThreadStart()
  InnerException: 
补充说明一下 ,这个错误只出现于 数据绑定后的TextBox控件上。
解决办法:  设置Textbox的UndoLimit 为0就ok。

TextBox的OnTextboxChanged事件里对Text重新赋值带中文, 导致崩溃相关推荐

  1. TextBox灵异事件之背后神秘的深度灵异事件真相揭秘

    最近又忙于秋色园和微博粉丝精灵的开发,本来N天前应该出来的文,迟来了好几天,今天抽空写了写,把事件的真相给大伙说清楚: 上篇:半解TextBox灵异事件背后神秘的深度灵异事件,一文中,一共提出两个问题 ...

  2. EasyUI TextBox的onkeypress事件

    EasyUI TextBox的onkeypress事件 关于EasyUI TextBox的事件好像不多,像keypress,keydown在textbox的事件里都没有,所以要用这些事件要采取一些特殊 ...

  3. 脚本精灵服务器引擎数据为空,求解,脚本单独能正常输出,写在控件事件里返回的都是空值...

    该楼层疑似违规已被系统折叠 隐藏此楼查看此楼 Function sousuo goods = Form1.InputBox1.Text hang = 0 Dim LazyExcel,path,Inde ...

  4. 半解TextBox灵异事件背后神秘的深度灵异事件

    2019独角兽企业重金招聘Python工程师标准>>> TextBox灵异事件: 就在前几天,当我来到当下所在的网络时,查看微博粉丝精灵后台时,一件很灵异的事情发生了:TextBox ...

  5. 【转】Android事件分发机制完全解析,带你从源码的角度彻底理解(下)

    转载请注明出处:http://blog.csdn.net/guolin_blog/article/details/9153761 记得在前面的文章中,我带大家一起从源码的角度分析了Android中Vi ...

  6. Android事件分发机制完全解析,带你从源码的角度彻底理解(上)

    <div id="container">         <div id="header">     <div class=&qu ...

  7. 解决thinphp里返回json时斜杆和中文被转义问题

    解决thinphp里返回json时斜杆和中文被转义问题 使用该命令来输出 json_encode($download_address,JSON_UNESCAPED_UNICODE|JSON_UNESC ...

  8. coreldraw x8段落_CORELDRAW里落文本如何单独改变中文字符的高度 CDR文字转曲插件 CorelDrawX8的使用说明...

    CORELDRAW里落文本如何单独改变中文字符的高度 CDR文字转曲插件 CorelDrawX8的使用说明 急!!请问:在CORELDRAW里段落文本如何单独改变中文字符的高度?请高手指教 急!!请问 ...

  9. VMware里建立虚拟机快照(带图详解)

    VMware里建立虚拟机快照(带图详解) 创建快照 如下图所示,想要创建快照有两种方法 可以自行修改名称和描述,修改好之后电机"拍摄快照"即可 此时大家可以看一下自己的快照是否建立 ...

  10. pdf文件里的英文如何翻译成中文

    在我们的工作和生活中有很多全英文的pdf文件,但是我们的英语还没有达到翻译全文的水准,这时候我们就需要翻译软件来翻译了,那么pdf文件里的英文如何翻译成中文呢? 因为pdf文件的封闭性,我们也不能将它 ...

最新文章

  1. H - Parity game-poj1733(需要离散化)
  2. Smart Card知识
  3. 关于zencart的magic zoom
  4. 计算机病毒教学评课,计算机病毒评课稿.docx
  5. Kafka配置1--Windows环境安装和配置Kafka
  6. user32.dll 函数说明
  7. CSS-fishc学习笔记
  8. 文件系统:NTFS、FAT32和exFAT
  9. Linux内核配置之Kconfig
  10. 中班音乐计算机反思,中班音乐游戏打字机教案反思
  11. RabbitMQ配置SSL
  12. SQL注入——猜测字段名称
  13. 小程序毕业设计 基于java后台微信在线视频点播小程序毕业设计参考
  14. 为什么生命科学企业都在陆续上云?
  15. ARM学习系列 ---- RISC和CISC概述
  16. ffmpeg解码内存中的数据
  17. 虚拟机-问题-Ubuntu安装VMware Tools
  18. wxml 点击图片下载_跟着做,零基础也能做出自己的小程序
  19. 武汉大学IGS数据中心网站的下载方法
  20. cad怎么转换成pdf格式

热门文章

  1. 【MIMO通信】基于matlab MIMO_OFDM通信系统仿真【含Matlab源码 314期】
  2. 【路径规划】基于matlab A星+改进A星的路径规划【含Matlab源码 225期】
  3. 【图像重建】基于matlab ASTRA算法图像重建【含Matlab源码 090期】
  4. nosql第一章课后习题
  5. jieba 结巴结巴结巴
  6. python的requests库入门必看
  7. java事件轮询_用scala实现的nio事件轮询
  8. 2013年8月华为java机试题目
  9. 巴西矿坝决堤事故已致58人死亡 多达300人失踪
  10. Python scapy网络包嗅探模块(转载)