Exception when opening a form using WPF ShowDialog


I have a WPF application when trying to open a form using ShowDialog() , I get this strange exception below on one machine.
Any idea what could be the problem?

Exception message = operation aborted (Exception from HRESULT: 0x80004004 (E_ABORT)) Trace exception stack =
in System.Runtime.InteropServices.Marshal.ThrowExceptionForHRInternal (Int32 errorCode, IntPtr errorInfo) in System.Runtime.InteropServices.Marshal.ThrowExceptionForHR (Int32 errorCode, IntPtr errorInfo) in MS.Internal.Text.TextIntereril h) in MS.Internal.Text.TextInterface.FontCollection.FindFamilyName (String familyName, UInt32 & index) in MS.Internal.FontCache.FamilyCollection.LookupFamily (String familyName, FontStyle & font style, FontWeight & fontWech, fontont & fontWech, Font & fontWech, Font & fontWech, Font & fontWech, Font & fontWech, Font System.Windows.Media.FontFamily.LookupFontFamilyAndFace (CanonicalFontFamilyReference canonicalFamilyReference, FontStyle & Style, FontWeight & Weight, FontStretch & Stretch) in System.Windows.Media.FontFamily.FindFirstFontFontFement & FontFamFtyA & FontAnd .Windows.Media.Typeface.ConstructCachedTypeface () in System.Windows.Media.Typeface.get_CachedTypeface () in MS.Intern al.TextFormatting.SimpleTextLine..ctor (FormatSettings settings, Int32 cpFirst, Int32 paragraphWidth, ArrayList, Int32 & trailing, Int32 & trailingSpaceWidth)
in MS.Internal.TextFormatting.SimpleTextLine.Create (FormatSettings settings, Int32 cpFirst, Int32 paragraphWidth) in MS.Internal.TextFormatting.TextFormatterImp.FormatLineInternal (TextSource textSource, Int32 firstCharIndex, Int32 lineLengperTextLine ItemFramePrintFramePoint DoubleChangeFunctionPoint DoubleChangeFunction LineFrequerPrintFramePoint DoubleChangeFunction LineFrequency textRunCache) in MS.Internal.TextFormatting.TextFormatterImp.FormatLine (TextSource textSource, Int32 firstCharIndex, Double paragraphWidth, TextParagraphProperties itemProperties, TextLineBreak previousLineBreak, TextRunCache Intr. , LineProperties lineProperties, TextRunCache textRunCache, TextFormatter formatting) in System.Windows.Controls.TextBoxView.FullMeasureTick (Double constraintWidth, LineProperties lineProperties) in System.Windows.Controls.TextBoxView.MeasureOverride (size limited ii) in System.Windows.FrameworkElement.MeasureCore (size availableSize) in System.Windows.UIElement.Measure (size availableSize) in MS.Internal.Helper.MeasureElementWithSingleChild (UIElement element, size limit) in System.Windows.Controls.ScrollContentPresenter. MeasureOverride (size limit) in System.Windows.FrameworkElement.MeasureCore (size availableSize) in System.Windows.UIElement.Measure (size availableSize) in System.Windows.Controls.Grid.MeasureCell (Int32 cell, Boolean power InfinityV) with System.Windows .Controls.Grid.MeasureCellsGroup (Int32 cellsHead, Size referenceSize, Boolean ignoreDesiredSizeU, Boolean forceInfinityV) under System.Windows.Controls.Grid.MeasureOverride (size limit) in System.Windows.FrameworkElement.MeasureCore (size availableWindowsize.) In System. UIElement.Measure (size availableSize) in System.Windows.Controls.Sc rollViewer.MeasureOverride (size limit) in System.Windows.FrameworkElement.MeasureCore (size availableSize) in System.Windows.UIElement.Measure (size availableSize) in System.Windows.Controls.Border.MeasureOverride (size limit) in System.Windows. FrameworkElement.MeasureCore (size availableSize) in System.Windows.UIElement.Measure (size availableSize) in System.Windows.Controls.Control.MeasureOverride (size limit) in System.Windows.FrameworkElement.MeasureCore (size availableSize) in System.Windows. UIElement.Measure (size availableSize) in System.Windows.Controls.Grid.MeasureCell (Int32 cell, Boolean force InfinityV) with System.Windows.Controls.Grid.MeasureCellsGroup (Int32 cellsHead, Size referenceSize, Boolean ignoreDesiredSizeU, Boolean forceInfinity. Windows.Controls.Grid.MeasureOverride (size limit) in System.Window s.FrameworkElement.MeasureCore (size availableSize) in System.Windows.UIElement.Measure (size availableSize) in System.Windows.Controls.StackPanel.MeasureOverride (size limit) in System .Windows.FrameworkElement.MeasureCore (size availableSize) in System. Windows.UIElement.Measure (size availableSize) in MS.Internal.Helper.MeasureElementWithSingleChild (UIElement element, size limit) in System.Windows.Controls.ContentPresenter.MeasureOverride (size limit) in System.Windows.FrameworkElement.MeasureCore (size availableSize) in System.Windows.UIElement.Measure (size availableSize) in System.Windows.Documents.AdornerDecorator.MeasureOverride (size limit) in System.Windows.FrameworkElement.MeasureCore (size availableSize) in System.Windows.UIElement.Measure (size availableSize) in System.Windows.Controls.Border.MeasureOverrid e (size limit) in System.Windows.FrameworkElement.MeasureCore (size availableSize) in System.Windows.UIElement.Measure (size availableSize) in System.Windows.Window.MeasureOverrideHelper (size limit) in System.Windows.Window.MeasureOverride ( size availableSize) in System.Windows.FrameworkElement.MeasureCore (size availableSize) in System.Windows.UIElement.Measure (size availableSize) in System.Windows.Interop.HwndSource.SetLayoutSize () in System.Windows.Interop.HwndSource.set_RootVisualIntern Visual value) with System.Windows.Interop.HwndSource.set_RootVisual (Visual value) with System.Windows.Window.SetRootVisual () in System.Windows.Window.SetRootVisualAndUpdateSTC () in System.Windows.Window.SetupInitialState (Double requestTop, requestedLeft, Double width request, Double requestHeight) in System.Windows.Window.CreateSourceWindow (Boolean in Show time) in System.Windows.Window.CreateSourceWindowDuringShow () in System.Windows.Window.SafeCreateWindowDuringShow () in System.Windows.Window.ShowHelper (booleanBox Object) in System.Windows.Window.Show () at System.Windows. Window.ShowDialog ()
in Alberstein.UI.Views.MainView.menuWorkOnline_Click (sender object, RoutedEventArgs e) in Alberstein.UI.Views.MainView.checkSyncstatus () in Alberstein.UI.App.OnStartup (sender object, StartupEventArgs e) in System.Windows.Application .OnStartup (StartupEventArgs is System.Windows.Application <.. ctor> b__1 (Object not used) in System.Windows.Threading.ExceptionWrapper.InternalRealCall (Delegate callback, Object args, Int32 numArgs) in MS.Internal.Threading.ExceptionFilterHelper. TryCatchWhen (Source object, delegation method, object arguments, Int32 numArgs, delegate catchHandler)

+4
source share
1 answer

I got the same error and the problem is with the Font Cache Service Windows Presentation Foundation. His cache file is somehow corrupted. Following the instructions in this MS KB article, http://support.microsoft.com/kb/937135 , I was able to solve the problem.

This applies to both Cache 3.0.0 and 4.0.0.0.

Before I found this article, I just stopped and disabled the service, and my WPF application started working. I suspect that disabling this will slow down the display of WPF applications (which is already quite slow), but after several machines have this issus in the field, I turned it off and have not had any problems since.

+6
source

Source: https://habr.com/ru/post/1340094/


All Articles