最近在开发了一个程序中用到了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.重新运行程序,发现这个问题已经解决了。

WPF PasswordBox鼠标进入时程序异常退出的解决办法的更多相关文章

  1. android捕获程序异常退出

    今天看到迅雷动漫里面一个CrashHandler 的类,我猜是崩溃处理类.进去一看.果然.顺便学习一下. Android系统的"程序异常退出",给应用的用户体验造成不良影响.为了捕 ...

  2. Android系统的“程序异常退出”[转]

    在应用运行过程中,有很多异常可能会发生,而我们希望在异常发生的时候第一时间的保存现场. 如何处理未捕获的异常呢? 首先我们要实现一个接口  java.lang.Thread.UncaughtExcep ...

  3. 程序异常退出 却没有产生core文件

    程序异常退出  却没有产生core文件 http://www.cnblogs.com/my_life/articles/4107333.html

  4. Linux C程序异常退出怎么办——core文件帮你忙

    Linux C程序异常退出怎么办——core文件帮你忙 http://blog.csdn.net/zhu2695/article/details/51512138

  5. main()如果返回0,则代表程序正常退出,返回非零代表程序异常退出。

    读到这里,大家应该了解了main函数返回值的来龙去脉了.下面介绍一下main函数返回值的作用以及如何获得这个返回值.main函数的返回值用于说明程序的退出状态.如果返回0,则代表程序正常退出.返回其它 ...

  6. .NETCore在析构函数(Finalize)在Linux下引起程序异常退出现象

    目       录 1.      现象概述... 1 2.      操作数据库的代码... 2 3.      引起的异常... 2 4.      异常信息分析... 3 5.      分析结 ...

  7. 爬虫爬数据时,post数据乱码解决办法

    最近在写一个爬虫,目标网站是:http://zx.bjmemc.com.cn/,可能是为了防止被爬取数据,它给自身数据加了密.用谷歌自带的抓包工具也不能捕获到数据.于是下了Fiddler.     F ...

  8. HttpClient的CircularRedirectException异常原因及解决办法

    HttpClient的CircularRedirectException异常原因及解决办法 这两天在使用我自己爬虫抓取网页的时候总是出现 org.apache.http.client.ClientPr ...

  9. oracle执行update语句时卡住问题分析及解决办法

    转载:http://www.jb51.net/article/125754.htm 这篇文章主要介绍了oracle执行update语句时卡住问题分析及解决办法,涉及记录锁等相关知识,具有一定参考价值, ...

随机推荐

  1. 【题解】Painting Fence

    [题解]Painting Fence 分治模板.贪心加分治.直接\(O(n^2logn)\)分治过去.考虑一块联通的柱形是子问题的,是递归的,贪心分治就可.记得对\(r-l+1\)取\(min\). ...

  2. java集合讲解干货集

    文章都来自网络,收集后便于查阅. 1.Java 集合系列01之 总体框架 2.Java 集合系列02之 Collection架构 3.Java 集合系列03之 ArrayList详细介绍(源码解析)和 ...

  3. SpringBoot学习笔记(1):配置Mybatis

    SpringBoot学习笔记(1):配置Mybatis 反思:如果自己写的笔记自己都看不懂,那就不要拿出来丢人现眼! IDEA插件 Free MyBatis Plugin插件可以让我们的MyBatis ...

  4. 《高性能Javascript》 Summary(二)

    第四章.算法和流程控制 Algorithms And Flow Control 原因:代码整体结构是执行速度的决定因素之一.代码量少不一定运行速度快,代码量多不一定运行速度慢.性能损失与组织代码和具体 ...

  5. 利用iOS原生系统进行人脸识别+自定义滤镜(GPUImage)

    人脸识别+滤镜效果(基于GPUImage实现的自定义滤镜) 最近碰到一个好玩的需求.说要客户端这边判定一下是否有人脸.在有的基础上.对相片做进一步的美化滤镜处理. 首先是人脸的识别判定; //将图片对 ...

  6. [egret+pomelo]实时游戏杂记(1)

    [egret+pomelo]学习笔记(1) [egret+pomelo]学习笔记(2) [egret+pomelo]学习笔记(3) 资料 egret pomelo pomelo捡宝项目 准备工作 1. ...

  7. MVC+Ext.net零基础学习记录(三)

    这里开始说明一下,如何在MVC项目中引用EXT.NET,这里参考:http://www.cnblogs.com/zhanghaomars/p/3470987.html

  8. ubuntu16.04固定IP与设置DNS【转】

    本文转载自:http://www.jianshu.com/p/ea4bca38e5d7 学校几乎每次断电之后,宿舍的机器IP基本都会更改,即使可以通过图形界面去修改,但还是懒得去改.但是docker某 ...

  9. Compiling: main.cpp /bin/sh: g++: not found

    Kbuntu用codeblocks编写C程序的时候,编译报错如下: Compiling: main.cpp/bin/sh: g++: not found 解决方法: sudo apt-get inst ...

  10. C++配置Opencv

    https://blog.csdn.net/qq_17550379/article/details/78201442