TextBox的OnTextboxChanged事件里对Text重新赋值带中文, 导致崩溃
来源:互联网 发布:外设天下淘宝店 编辑:程序博客网 时间:2024/06/13 02:28
今天遇到一个超级bug, Textbox做了限制, 只能输入数字。 结果在搜狗输入法输入中文时导致崩溃, 出错信息如下:
未处理 System.InvalidOperationException
Message=无法关闭撤消单元,因为不存在已打开的单元。
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。
0 0
- TextBox的OnTextboxChanged事件里对Text重新赋值带中文, 导致崩溃
- TextBox的OnTextboxChanged事件里对Text重新赋值带中文, 导致崩溃
- 对事件‘赋值’的例子
- HTML里的一个TD里面的TEXTBOX对齐(TEXTBOX与TEXT的对齐问题)
- 内核模块里的一点错误直接导致系统崩溃
- easyui的带按钮的textbox的事件绑定
- 对Text控件增量赋值的代码优化
- 对Text控件增量赋值的代码优化
- 给textbox的lines赋值
- gridview里模板列使用textbox、button赋值取值,以及全选按钮的使用
- Silverlight 4里Textbox在失去焦点之前无法获取到Text值的另类解决方法
- 获取动态textbox的Text
- [VB.NET]如何快速给100个textbox.text赋值?
- jQuery事件问题 对jQuery.ajax异步创建的html元素的绑定事件 必须在success里重新绑定 否则无效
- TextBox的回车事件
- Jquery对一些常用控件的取值、赋值<textbox,button,lable,radio,checkbox,selected >
- 右侧带按钮的TextBox
- easyui 带按钮的textbox
- OD关键字搜索
- 递归基础篇
- 自动更新程序源码下载(C#.Net)
- jquery插件省市三级联动
- 数据库配置链接
- TextBox的OnTextboxChanged事件里对Text重新赋值带中文, 导致崩溃
- URLConnection 和HttpURLConnection
- 瀚海电脑锁定2012 v5.3.1.0官方版
- Android 开源组件和第三方库汇总
- iOS设计模式
- Android实现socket简单通信
- Vivado 约束条件出错
- [Java Web]Error parsing HTTP request header Note: further occurrences of HTTP header parsing errors
- Eventbus3.0