最近在开发了一个程序中用到了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. sql 时间转换格式

    convert(varchar(10),字段名,转换格式) CONVERT(nvarchar(10),count_time,121)CONVERT为日期转换函数,一般就是在时间类型(datetime, ...

  2. String知识点

  3. bootstrap中模态框的大小设置;

    bootstrap模态框调节大小: 大尺寸:黑体加大的字体,是更改的代码 <!-- 大模态框的调节 --> <button type="button" class ...

  4. EasyPlayerPro(Windows)流媒体播放器功能介绍及应用场景

    EasyPLyerPro(Windows)经过为期一个月的开发已经基本完成,虽然目前仍存在一些小问题,但是总体功能还是趋于比较稳定和强大的,下面对其功能和应用场景做简要介绍. 一.EasyPlayer ...

  5. django框架小技巧

    带命名空间的URL名字 多应用中路由定义,采用命名空间,防止冲突 url(r'^polls/', include('polls.urls', namespace="polls")) ...

  6. android菜鸟学习笔记1----环境搭建

    Step1 JDK安装及配置: 1.下载并安装JDK: 根据自己系统情况,选择安装相应的JDK版本 当前系统:64位WIN8,内存8G 选择了Java SE 8u45 即JDK 1.8.0_45,可以 ...

  7. lasso the moon

  8. HTML 学习笔记 JQuery(盒子操作)

    这边博客详细的讲述一下JQuery中关于盒子模型的一些方法 offset([coordinates])方法 获取匹配元素在当前适口的相对偏移 返回的对象包含两个模型属性:top和left 以像素计.此 ...

  9. linux c编程:文件的读写

    Linux系统中提供了系统调用函数open()和close()用于打开和关闭一个存在的文件 int open(const char *pathname,int flags) int open(cons ...

  10. get_linux_ip_info.sh 获取ip地址

    linux 获取ip地址 get_linux_ip_info.sh #!/bin/bash #/告诉使用者,这程序的用户是从ipconfig 命令中获取IP地址 echo "该程序是从命令中 ...