WPF PasswordBox鼠标进入时程序异常退出的解决办法
2024-10-20 01:39:58
最近在开发了一个程序中用到了PasswordBox控件,但是在程序给别人用的时候,鼠标一进入控件时程序就异常退出,查了下windows日志,错误显示如下:
应用程序: WpfPasswordTest2.exe
Framework 版本: v4.0.30319
说明: 应用程序通过 System.Environment.FailFast(string message) 请求终止进程。
消息: 不可恢复的系统错误。
堆栈:
在 System.Environment.FailFast(System.String)
在 MS.Internal.Invariant.FailFast(System.String, System.String)
在 MS.Internal.Invariant.Assert(Boolean)
在 System.Windows.Media.FontFamily.get_FirstFontFamily()
在 System.Windows.Media.FontFamily.get_LineSpacing()
在 System.Windows.Documents.TextSelection.CalculateCaretRectangle(System.Windows.Documents.ITextSelection, System.Windows.Documents.ITextPointer)
在 System.Windows.Documents.TextSelection.UpdateCaretStateWorker(System.Object)
在 System.Windows.Documents.TextSelection.UpdateCaretState(System.Windows.Documents.CaretScrollMethod)
在 System.Windows.Documents.TextSelection.EnsureCaret(Boolean, Boolean, System.Windows.Documents.CaretScrollMethod)
在 System.Windows.Documents.TextSelection.System.Windows.Documents.ITextSelection.UpdateCaretAndHighlight()
在 System.Windows.Documents.TextEditor.OnGotKeyboardFocus(System.Object, System.Windows.Input.KeyboardFocusChangedEventArgs)
在 System.Windows.Controls.PasswordBox.OnGotKeyboardFocus(System.Windows.Input.KeyboardFocusChangedEventArgs)
在 System.Windows.UIElement.OnGotKeyboardFocusThunk(System.Object, System.Windows.Input.KeyboardFocusChangedEventArgs)
在 System.Windows.Input.KeyboardFocusChangedEventArgs.InvokeEventHandler(System.Delegate, System.Object)
在 System.Windows.RoutedEventArgs.InvokeHandler(System.Delegate, System.Object)
在 System.Windows.RoutedEventHandlerInfo.InvokeHandler(System.Object, System.Windows.RoutedEventArgs)
在 System.Windows.EventRoute.InvokeHandlersImpl(System.Object, System.Windows.RoutedEventArgs, Boolean)
在 System.Windows.UIElement.RaiseEventImpl(System.Windows.DependencyObject, System.Windows.RoutedEventArgs)
在 System.Windows.UIElement.RaiseTrustedEvent(System.Windows.RoutedEventArgs)
在 System.Windows.UIElement.RaiseEvent(System.Windows.RoutedEventArgs, Boolean)
在 System.Windows.Input.InputManager.ProcessStagingArea()
在 System.Windows.Input.InputManager.ProcessInput(System.Windows.Input.InputEventArgs)
在 System.Windows.Input.KeyboardDevice.ChangeFocus(System.Windows.DependencyObject, Int32)
在 System.Windows.Input.KeyboardDevice.TryChangeFocus(System.Windows.DependencyObject, System.Windows.Input.IKeyboardInputProvider, Boolean, Boolean, Boolean)
在 System.Windows.Input.KeyboardDevice.Focus(System.Windows.DependencyObject, Boolean, Boolean, Boolean)
在 System.Windows.Input.KeyboardDevice.Focus(System.Windows.IInputElement)
在 System.Windows.UIElement.Focus()
在 System.Windows.Documents.TextEditorMouse.MoveFocusToUiScope(System.Windows.Documents.TextEditor)
在 System.Windows.Documents.TextEditorMouse.OnMouseDown(System.Object, System.Windows.Input.MouseButtonEventArgs)
在 System.Windows.Controls.PasswordBox.OnMouseDown(System.Windows.Input.MouseButtonEventArgs)
在 System.Windows.UIElement.OnMouseDownThunk(System.Object, System.Windows.Input.MouseButtonEventArgs)
在 System.Windows.Input.MouseButtonEventArgs.InvokeEventHandler(System.Delegate, System.Object)
在 System.Windows.RoutedEventArgs.InvokeHandler(System.Delegate, System.Object)
在 System.Windows.RoutedEventHandlerInfo.InvokeHandler(System.Object, System.Windows.RoutedEventArgs)
在 System.Windows.EventRoute.InvokeHandlersImpl(System.Object, System.Windows.RoutedEventArgs, Boolean)
在 System.Windows.UIElement.RaiseEventImpl(System.Windows.DependencyObject, System.Windows.RoutedEventArgs)
在 System.Windows.UIElement.RaiseTrustedEvent(System.Windows.RoutedEventArgs)
在 System.Windows.UIElement.RaiseEvent(System.Windows.RoutedEventArgs, Boolean)
在 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.HwndMouseInputProvider.ReportInput(IntPtr, System.Windows.Input.InputMode, Int32, System.Windows.Input.RawMouseActions, Int32, Int32, Int32)
在 System.Windows.Interop.HwndMouseInputProvider.FilterMessage(IntPtr, MS.Internal.Interop.WindowMessage, IntPtr, IntPtr, Boolean ByRef)
在 System.Windows.Interop.HwndSource.InputFilterMessage(IntPtr, Int32, IntPtr, IntPtr, Boolean ByRef)
在 MS.Win32.HwndWrapper.WndProc(IntPtr, Int32, IntPtr, IntPtr, Boolean ByRef)
在 MS.Win32.HwndSubclass.DispatcherCallbackOperation(System.Object)
在 System.Windows.Threading.ExceptionWrapper.InternalRealCall(System.Delegate, System.Object, Int32)
在 MS.Internal.Threading.ExceptionFilterHelper.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)
在 MS.Win32.HwndSubclass.SubclassWndProc(IntPtr, Int32, IntPtr, IntPtr)
在 MS.Win32.UnsafeNativ
后面经查证,是由于系统字体的原因,具体的解决办法如下:
1.在一台正常运行passwordbox控件的电脑中,拷贝C:\Windows\Fonts下的所有文件
2.将拷贝的文件复制到C:\Windows\Fonts下,提示安装,选择全部覆盖安装即可。
3.重新运行程序,发现这个问题已经解决了。
最新文章
- padding
- C语言初学者代码中的常见错误与瑕疵(19)
- jsonUtil 工具类
- 使用mii-tool设置网卡速率
- HTML DOM与XML DOM之间,既有区别
- croppic 图片裁剪
- python多线程 批量下补丁
- Java中List集合去除重复数据的四种方法
- Mac改键软件Karabiner使用教程
- Python replace
- Git 学习笔记--删除错误提交的commit
- c#除掉字符串最后一个字符几种方法
- ueditor修改工具栏固定位置和显示空白div
- nginx File not found 错误(转)
- SpringBoot整合Quartz定时任务 系统job Spring Boot教程 调度任务
- pomelo 安装
- 使用POI动态更新导出的EXCEL模板中的列
- svn add @2x image 文件
- 关于从SVN检出项目后,项目名称还是之前修改之前或者项目名称不对问题
- win10安装MySQL免安装版
热门文章
- API自动化测试利器——Postman
- 【BZOJ3319】黑白树 并查集
- 怎么利用Aspose.Cells 获取excel 数据表中sheet的名称
- 九度OJ 1044:Pre-Post(先序后序) (n叉树、递归)
- react-navigation遇到的坑
- linux下更改文件夹名
- 【Leetcode-easy】String to Integer(atoi)
- Antler 工具使用(.g 转.java / .cs)
- 51nod 1737配对
- Vue.js devtool插件安装后无法使用的解决办法