Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Exception when opening a Form using WPF's ShowDialog


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

Exception Message = Operation aborted (Exception from HRESULT: 0x80004004 (E_ABORT)) Exception stack trace =
at System.Runtime.InteropServices.Marshal.ThrowExceptionForHRInternal(Int32 errorCode, IntPtr errorInfo) at System.Runtime.InteropServices.Marshal.ThrowExceptionForHR(Int32 errorCode, IntPtr errorInfo) at MS.Internal.Text.TextInterface.Native.Util.ConvertHresultToException(Int32 hr) at MS.Internal.Text.TextInterface.FontCollection.FindFamilyName(String familyName, UInt32& index) at MS.Internal.FontCache.FamilyCollection.LookupFamily(String familyName, FontStyle& fontStyle, FontWeight& fontWeight, FontStretch& fontStretch) at System.Windows.Media.FontFamily.LookupFontFamilyAndFace(CanonicalFontFamilyReference canonicalFamilyReference, FontStyle& style, FontWeight& weight, FontStretch& stretch) at System.Windows.Media.FontFamily.FindFirstFontFamilyAndFace(FontStyle& style, FontWeight& weight, FontStretch& stretch) at System.Windows.Media.Typeface.ConstructCachedTypeface() at System.Windows.Media.Typeface.get_CachedTypeface() at MS.Internal.TextFormatting.SimpleTextLine..ctor(FormatSettings settings, Int32 cpFirst, Int32 paragraphWidth, ArrayList runs, Int32& trailing, Int32& trailingSpaceWidth)
at MS.Internal.TextFormatting.SimpleTextLine.Create(FormatSettings settings, Int32 cpFirst, Int32 paragraphWidth) at MS.Internal.TextFormatting.TextFormatterImp.FormatLineInternal(TextSource textSource, Int32 firstCharIndex, Int32 lineLength, Double paragraphWidth, TextParagraphProperties paragraphProperties, TextLineBreak previousLineBreak, TextRunCache textRunCache) at MS.Internal.TextFormatting.TextFormatterImp.FormatLine(TextSource textSource, Int32 firstCharIndex, Double paragraphWidth, TextParagraphProperties paragraphProperties, TextLineBreak previousLineBreak, TextRunCache textRunCache) at System.Windows.Controls.TextBoxLine.Format(Int32 dcp, Double formatWidth, Double paragraphWidth, LineProperties lineProperties, TextRunCache textRunCache, TextFormatter formatter) at System.Windows.Controls.TextBoxView.FullMeasureTick(Double constraintWidth, LineProperties lineProperties) at System.Windows.Controls.TextBoxView.MeasureOverride(Size constraint) at System.Windows.FrameworkElement.MeasureCore(Size availableSize) at System.Windows.UIElement.Measure(Size availableSize) at MS.Internal.Helper.MeasureElementWithSingleChild(UIElement element, Size constraint) at System.Windows.Controls.ScrollContentPresenter.MeasureOverride(Size constraint) at System.Windows.FrameworkElement.MeasureCore(Size availableSize) at System.Windows.UIElement.Measure(Size availableSize) at System.Windows.Controls.Grid.MeasureCell(Int32 cell, Boolean forceInfinityV) at System.Windows.Controls.Grid.MeasureCellsGroup(Int32 cellsHead, Size referenceSize, Boolean ignoreDesiredSizeU, Boolean forceInfinityV) at System.Windows.Controls.Grid.MeasureOverride(Size constraint) at System.Windows.FrameworkElement.MeasureCore(Size availableSize) at System.Windows.UIElement.Measure(Size availableSize) at System.Windows.Controls.ScrollViewer.MeasureOverride(Size constraint) at System.Windows.FrameworkElement.MeasureCore(Size availableSize) at System.Windows.UIElement.Measure(Size availableSize) at System.Windows.Controls.Border.MeasureOverride(Size constraint) at System.Windows.FrameworkElement.MeasureCore(Size availableSize) at System.Windows.UIElement.Measure(Size availableSize) at System.Windows.Controls.Control.MeasureOverride(Size constraint) at System.Windows.FrameworkElement.MeasureCore(Size availableSize) at System.Windows.UIElement.Measure(Size availableSize) at System.Windows.Controls.Grid.MeasureCell(Int32 cell, Boolean forceInfinityV) at System.Windows.Controls.Grid.MeasureCellsGroup(Int32 cellsHead, Size referenceSize, Boolean ignoreDesiredSizeU, Boolean forceInfinityV) at System.Windows.Controls.Grid.MeasureOverride(Size constraint) at System.Windows.FrameworkElement.MeasureCore(Size availableSize) at System.Windows.UIElement.Measure(Size availableSize) at System.Windows.Controls.StackPanel.MeasureOverride(Size constraint) at System.Windows.FrameworkElement.MeasureCore(Size availableSize) at System.Windows.UIElement.Measure(Size availableSize) at MS.Internal.Helper.MeasureElementWithSingleChild(UIElement element, Size constraint) at System.Windows.Controls.ContentPresenter.MeasureOverride(Size constraint) at System.Windows.FrameworkElement.MeasureCore(Size availableSize) at System.Windows.UIElement.Measure(Size availableSize) at System.Windows.Documents.AdornerDecorator.MeasureOverride(Size constraint) at System.Windows.FrameworkElement.MeasureCore(Size availableSize) at System.Windows.UIElement.Measure(Size availableSize) at System.Windows.Controls.Border.MeasureOverride(Size constraint) at System.Windows.FrameworkElement.MeasureCore(Size availableSize) at System.Windows.UIElement.Measure(Size availableSize) at System.Windows.Window.MeasureOverrideHelper(Size constraint) at System.Windows.Window.MeasureOverride(Size availableSize) at System.Windows.FrameworkElement.MeasureCore(Size availableSize) at System.Windows.UIElement.Measure(Size availableSize) at System.Windows.Interop.HwndSource.SetLayoutSize() at System.Windows.Interop.HwndSource.set_RootVisualInternal(Visual value) at System.Windows.Interop.HwndSource.set_RootVisual(Visual value) at System.Windows.Window.SetRootVisual() at System.Windows.Window.SetRootVisualAndUpdateSTC() at System.Windows.Window.SetupInitialState(Double requestedTop, Double requestedLeft, Double requestedWidth, Double requestedHeight) at System.Windows.Window.CreateSourceWindow(Boolean duringShow) at System.Windows.Window.CreateSourceWindowDuringShow() at System.Windows.Window.SafeCreateWindowDuringShow() at System.Windows.Window.ShowHelper(Object booleanBox) at System.Windows.Window.Show() at System.Windows.Window.ShowDialog()
at Alberstein.UI.Views.MainView.menuWorkOnline_Click(Object sender, RoutedEventArgs e) at Alberstein.UI.Views.MainView.checkSyncstatus() at Alberstein.UI.App.OnStartup(Object sender, StartupEventArgs e) at System.Windows.Application.OnStartup(StartupEventArgs e) at System.Windows.Application.<.ctor>b__1(Object unused) at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs) at MS.Internal.Threading.ExceptionFilterHelper.TryCatchWhen(Object source, Delegate method, Object args, Int32 numArgs, Delegate catchHandler)

like image 628
Emad Gabriel Avatar asked Feb 16 '11 22:02

Emad Gabriel


1 Answers

I've experienced this same error, and the problem is with the Windows Presentation Foundation Font Cache Service. Its cache file is somehow corrupted. By following the instructions in this MS KB article, http://support.microsoft.com/kb/937135, I was able to get the problem to go away.

This applies to both the 3.0.0.0 and 4.0.0.0 versions of the Cache.

Before I found that article, I had just stopped and disabled the service, and my WPF application started right up. I suspect disabling it will cause a slow down in displaying WPF applications (which is slow enough already), but after having several machines in the field have this issus, I disabled it and have had no problems since.

like image 194
ToddK Avatar answered Oct 07 '22 01:10

ToddK