WPF passwordbox resolution for program exception exit when mouse entry

Source: Internet
Author: User

Recently in the development of a program used in the PasswordBox control, but in the program to others, when the mouse into the control when the program exits unexpectedly, checked the Windows log, the error is shown as follows:

Application: Wpfpasswordtest2.exeframework Version: v4.0.30319 Description: The application terminated the process through a System.Environment.FailFast (string message) request. Message: Unrecoverable system error. Stack: in System.Environment.FailFast (System.String) in MS. Internal.Invariant.FailFast (System.String, System.String) in MS. Internal.Invariant.Assert (Boolean) in System.Windows.Media.FontFamily.get_FirstFontFamily () in System.Windows.Media.FontFamily.get_LineSpacing () in System.Windows.Documents.TextSelection.CalculateCaretRectangle (System.Windows.Documents.ITextSelection, System.Windows.Documents.ITextPointer) in System.Windows.Documents.TextSelection.UpdateCaretStateWorker ( System.Object) in System.Windows.Documents.TextSelection.UpdateCaretState ( System.Windows.Documents.CaretScrollMethod) in System.Windows.Documents.TextSelection.EnsureCaret (Boolean, Boolean , System.Windows.Documents.CaretScrollMethod) in System.Windows.Documents.TextSelection.System.Windows.Documents.ITextSelection.UpdateCaretAndHighlight () in System.Windows.Documents.TextEditor.OnGotKEyboardfocus (System.Object, System.Windows.Input.KeyboardFocusChangedEventArgs) in System.Windows.Controls.PasswordBox.OnGotKeyboardFocus (System.Windows.Input.KeyboardFocusChangedEventArgs) in System.Windows.UIElement.OnGotKeyboardFocusThunk (System.Object, System.Windows.Input.KeyboardFocusChangedEventArgs) in System.Windows.Input.KeyboardFocusChangedEventArgs.InvokeEventHandler (System.Delegate, System.Object) in System.Windows.RoutedEventArgs.InvokeHandler (System.Delegate, System.Object) in System.Windows.RoutedEventHandlerInfo.InvokeHandler (System.Object, System.Windows.RoutedEventArgs) in System.Windows.EventRoute.InvokeHandlersImpl (System.Object, System.Windows.RoutedEventArgs, Boolean) in System.Windows.UIElement.RaiseEventImpl (System.Windows.DependencyObject, System.Windows.RoutedEventArgs) in System.Windows.UIElement.RaiseTrustedEvent (System.Windows.RoutedEventArgs) in System.Windows.UIElement.RaiseEvent (System.Windows.RoutedEventArgs, Boolean) in System.Windows.Input.Inputmanager.processstagingarea () in System.Windows.Input.InputManager.ProcessInput ( System.Windows.Input.InputEventArgs) in System.Windows.Input.KeyboardDevice.ChangeFocus ( System.Windows.DependencyObject, Int32) in System.Windows.Input.KeyboardDevice.TryChangeFocus ( System.Windows.DependencyObject, System.Windows.Input.IKeyboardInputProvider, Boolean, Boolean, Boolean) in System.Windows.Input.KeyboardDevice.Focus (System.Windows.DependencyObject, Boolean, Boolean, Boolean) in System.Windows.Input.KeyboardDevice.Focus (System.Windows.IInputElement) in System.Windows.UIElement.Focus () in System.Windows.Documents.TextEditorMouse.MoveFocusToUiScope (System.Windows.Documents.TextEditor) in System.Windows.Documents.TextEditorMouse.OnMouseDown (System.Object, System.Windows.Input.MouseButtonEventArgs) in System.Windows.Controls.PasswordBox.OnMouseDown (System.Windows.Input.MouseButtonEventArgs) in System.Windows.UIElement.OnMouseDownThunk (System.Object, System.Windows.Input.MouseButtonEveNtargs) in System.Windows.Input.MouseButtonEventArgs.InvokeEventHandler (System.Delegate, System.Object) in System.Windows.RoutedEventArgs.InvokeHandler (System.Delegate, System.Object) in System.Windows.RoutedEventHandlerInfo.InvokeHandler (System.Object, System.Windows.RoutedEventArgs) in System.Windows.EventRoute.InvokeHandlersImpl (System.Object, System.Windows.RoutedEventArgs, Boolean) in System.Windows.UIElement.RaiseEventImpl (System.Windows.DependencyObject, System.Windows.RoutedEventArgs) in System.Windows.UIElement.RaiseTrustedEvent (System.Windows.RoutedEventArgs) in System.Windows.UIElement.RaiseEvent (System.Windows.RoutedEventArgs, Boolean) in System.Windows.Input.InputManager.ProcessStagingArea () in System.Windows.Input.InputManager.ProcessInput (System.Windows.Input.InputEventArgs) in System.Windows.Input.InputProviderSite.ReportInput (System.Windows.Input.InputReport) in System.Windows.Interop.HwndMouseInputProvider.ReportInput (INTPTR, System.Windows.Input.InputMode, Int32, System.Windows.Input.RawMouseActions, Int32, Int32, Int32) in System.Windows.Interop.HwndMouseInputProvider.FilterMessage (IntPtr, MS. Internal.Interop.WindowMessage, IntPtr, IntPtr, Boolean ByRef) in System.Windows.Interop.HwndSource.InputFilterMessage (IntPtr, Int32, IntPtr, IntPtr, Boolean ByRef) in MS. Win32.HwndWrapper.WndProc (IntPtr, Int32, IntPtr, IntPtr, Boolean ByRef) in MS. Win32.HwndSubclass.DispatcherCallbackOperation (System.Object) in System.Windows.Threading.ExceptionWrapper.InternalRealCall (System.Delegate, System.Object, Int32) in MS. Internal.Threading.ExceptionFilterHelper.TryCatchWhen (System.Object, System.Delegate, System.Object, Int32, System.Delegate) in System.Windows.Threading.Dispatcher.LegacyInvokeImpl ( System.Windows.Threading.DispatcherPriority, System.TimeSpan, System.Delegate, System.Object, Int32) in MS. Win32.HwndSubclass.SubclassWndProc (IntPtr, Int32, IntPtr, IntPtr) in MS. Win32.unsafenativ
View Code

After the verification, is due to the system font, the specific solution is as follows:

1. Copy all files under C:\Windows\Fonts in a computer that is running the PasswordBox control properly

2. Copy the copied files to C:\Windows\Fonts, prompt to install, select all overwrite the installation.

3. Rerun the program and find that the problem has been resolved.

WPF passwordbox resolution for program exception exit when mouse entry

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.