WPF TextBox 联动 Popup, Popup里面包含了GridViewDataControl, 输入中文报错。

我是使用Popup里面的GridViewData代替了下拉框,输入之后可以可以根据代码和中文模糊查询,筛选出数据就把 Popup显示出来,反之隐藏。

输入1 ,可以带出如上数据,选择第一条,没问题,没有报错。

但是如果再此基础上再输入中文,就出现报错了。

错误如下:

丝毫没有头绪,不过我根据规律发现,只要TextBox联动的Popup里面不包含GridViewData 就不会报错,一旦加载了GridViewData 就会必现,整个系统崩溃。

【此错误可能是 CLR 中的 bug,或者是用户代码的不安全部分或不可验证部分中的 bug。此 bug 的常见来源包括用户对 COM-interop 或 PInvoke 的封送处理错误,这些错误可能会损坏堆栈。】

Windows 日志信息:

应用程序: ExportClient.exe
Framework 版本: v4.0.30319
说明: 应用程序通过 System.Environment.FailFast(string message) 请求终止进程。
消息: 不可恢复的系统错误。
堆栈:
在 System.Environment.FailFast(System.String)
在 MS.Internal.Invariant.FailFast(System.String, System.String)
在 System.Windows.Documents.TextStore.SetFinalDocumentState(MS.Internal.Documents.UndoManager, System.Collections.Stack, Int32, Int32, Int32, Int32, Int32)
在 System.Windows.Documents.TextStore.HandleCompositionEvents(Int32)
在 System.Windows.Documents.TextStore.GrantLockWorker(LockFlags)
在 System.Windows.Documents.TextStore.RequestLock(LockFlags, Int32 ByRef)
在 MS.Win32.UnsafeNativeMethods+ITfKeystrokeMgr.KeyDown(Int32, Int32, Boolean ByRef)
在 System.Windows.Input.TextServicesContext.Keystroke(Int32, Int32, KeyOp)
在 System.Windows.Input.TextServicesManager.TextServicesKeystroke(System.Windows.Input.TextServicesContext, System.Windows.Input.KeyEventArgs, Boolean)
在 System.Windows.Input.TextServicesManager.PostProcessInput(System.Object, System.Windows.Input.ProcessInputEventArgs)
在 System.Windows.Input.InputManager.RaiseProcessInputEventHandlers(System.Windows.Input.ProcessInputEventHandler, System.Windows.Input.ProcessInputEventArgs)
在 System.Windows.Input.InputManager.ProcessStagingArea()
在 System.Windows.Input.InputManager.ProcessInput(System.Windows.Input.InputEventArgs)
在 System.Windows.Input.InputProviderSite.ReportInput(System.Windows.Input.InputReport)
在 System.Windows.Interop.HwndKeyboardInputProvider.ReportInput(IntPtr, System.Windows.Input.InputMode, Int32, System.Windows.Input.RawKeyboardActions, Int32, Boolean, Boolean, Int32)
在 System.Windows.Interop.HwndKeyboardInputProvider.ProcessKeyAction(System.Windows.Interop.MSG ByRef, Boolean ByRef)
在 System.Windows.Interop.HwndSource.CriticalTranslateAccelerator(System.Windows.Interop.MSG ByRef, System.Windows.Input.ModifierKeys)
在 System.Windows.Interop.HwndSource.OnPreprocessMessage(System.Object)
在 System.Windows.Threading.ExceptionWrapper.InternalRealCall(System.Delegate, System.Object, Int32)
在 System.Windows.Threading.ExceptionWrapper.TryCatchWhen(System.Object, System.Delegate, System.Object, Int32, System.Delegate)
在 System.Windows.Threading.Dispatcher.LegacyInvokeImpl(System.Windows.Threading.DispatcherPriority, System.TimeSpan, System.Delegate, System.Object, Int32)
在 System.Windows.Threading.Dispatcher.Invoke(System.Windows.Threading.DispatcherPriority, System.Delegate, System.Object)
在 System.Windows.Interop.HwndSource.OnPreprocessMessageThunk(System.Windows.Interop.MSG ByRef, Boolean ByRef)
在 System.Windows.Interop.HwndSource+WeakEventPreprocessMessage.OnPreprocessMessage(System.Windows.Interop.MSG ByRef, Boolean ByRef)
在 System.Windows.Interop.ThreadMessageEventHandler.Invoke(System.Windows.Interop.MSG ByRef, Boolean ByRef)
在 System.Windows.Interop.ComponentDispatcherThread.RaiseThreadMessage(System.Windows.Interop.MSG ByRef)
在 System.Windows.Threading.Dispatcher.PushFrameImpl(System.Windows.Threading.DispatcherFrame)
在 System.Windows.Threading.Dispatcher.PushFrame(System.Windows.Threading.DispatcherFrame)
在 System.Windows.Application.RunDispatcher(System.Object)
在 System.Windows.Application.RunInternal(System.Windows.Window)
在 System.Windows.Application.Run(System.Windows.Window)
在 System.Windows.Application.Run()
在 ExportClient.App.Main()

错误应用程序名称: ExportClient.exe,版本: 2.0.54.0,时间戳: 0x5f0677c2
错误模块名称: WindowsBase.ni.dll,版本: 4.8.4180.0,时间戳: 0x5e7d256c
异常代码: 0x80131623
错误偏移量: 0x0029a9e0
错误进程 ID: 0x4bd0
错误应用程序启动时间: 0x01d6559dcb67baa6
错误应用程序路径: F:\XXXXX
ExportClient\bin\Debug\ExportClient.exe
错误模块路径: C:\Windows\assembly\NativeImages_v4.0.30319_32\WindowsBase\f6a15e754119cc1cac9914d077eafb40\WindowsBase.ni.dll
报告 ID: 0d4c2d7c-a6a3-4e5e-87f7-6234f3eb9ce1
错误程序包全名:
错误程序包相对应用程序 ID:

回答

你其实已经说出了原因

  1. 中文
  2. Popup+gridviewdata
    任何一个因素不出现,就不会有BUG,那你想办法避免其中一个呗。
以上是WPF TextBox 联动 Popup, Popup里面包含了GridViewDataControl, 输入中文报错。的全部内容。
THE END
分享
二维码
< <上一篇
下一篇>>