使用WPF的ShowDialog打开表单时出现异常

Ema*_*iel 4 .net wpf exception


我有一个WPF应用程序,当尝试使用时打开一个表单ShowDialog(),我在下面的一台机器上得到了这个奇怪的例外.
知道问题可能是什么?

异常消息=操作已中止(HRESULT异常:0x80004004(E_ABORT))异常堆栈跟踪=
System.Runtime.InteropServices.Marshal.ThrowExceptionForHRInternal(Int32 errorCode,IntPtr errorInfo)System.Runtime.InteropServices.Marshal.ThrowExceptionForHR(Int32 errorCode, MS.Internal.FontCache.FamCollection.LookupFamily上的MS.Internal.Text.TextInterface.FontCollection.FindFamilyName(String familyName,UInt32&index)中的MS.Internal.Text.TextInterface.Native.Util.ConvertHresultToException(Int32hr)处的IntPtr errorInfo) System.Windows.Media.FontFamily.LookupFontFamilyAndFace(CanonicalFontFamilyReference canonicalFamilyReference,FontStyle&style,FontWeight&weight,FontStretch&stretch)在System.Windows.Media.FontFamily.FindFirstFontFamilyAndFace上的字符串familyName,FontStyle&fontStyle,FontWeight&fontWeight,FontStretch&fontStretch(FontStyle&style,在Syste的System.Windows.Media.Typeface.ConstructCachedTypeface()的FontWeight&weight,FontStretch&stretch)m.Windows.Media.Typeface.get_CachedTypeface()在MS.Internal.TextFormatting.SimpleTextLine..ctor(FormatSettings设置,的Int32 cpFirst,的Int32 paragraphWidth,ArrayList中运行时,的Int32&后,的Int32&trailingSpaceWidth)
在MS.Internal.TextFormatting.SimpleTextLine.在MS.Internal.TextFormatting的MS.Internal.TextFormatting.TextFormatterImp.FormatLineInternal(TextSource textSource,Int32 firstCharIndex,Int32 lineLength,Double paragraphWidth,TextParagraphProperties paragraphProperties,TextLineBreak previousLineBreak,TextRunCache textRunCache)中创建(FormatSettings设置,Int32 cpFirst,Int32 paragraphWidth). System.Windows.Controls.TextBoxLine.Format(Int32 dcp,Double formatWidth,Double paragraphWidth,LineProperties lineProperties,TextRunCache textRunCache,TextFormatter formatt)中的TextFormatterImp.FormatLine(TextSource textSource,Int32 firstCharIndex,Double paragraphWidth,TextParagraphProperties paragraphProperties,TextLineBreak previousLineBreak,TextRunCache textRunCache)呃)System.Windows上的System.Windows.FrameworkElement.MeasureCore(Size availableSize)上的System.Windows.Controls.TextBoxView.MeasureOverride(Size constraint)中的System.Windows.Controls.TextBoxView.FullMeasureTick(Double constraintWidth,LineProperties lineProperties). UIElement.Measure(尺码availableSize)在MS.Internal.Helper.MeasureElementWithSingleChild(的UIElement元件,尺寸约束)在System.Windows.Controls.ScrollContentPresenter.MeasureOverride(尺寸约束)在System.Windows.FrameworkElement.MeasureCore(尺码availableSize)在系统.Windows.UIElement.Measure(尺码availableSize)在System.Windows.Controls.Grid.MeasureCell(的Int32细胞,布尔forceInfinityV)在System.Windows.Controls.Grid.MeasureCellsGroup(的Int32 cellsHead,尺寸referenceSize,布尔ignoreDesiredSizeU,布尔forceInfinityV) System.Windows.UIElement.Measure上的System.Windows.FrameworkElement.MeasureCore(Size availableSize)中的System.Windows.Controls.Grid.MeasureOverride(Size约束)(大小可用)System.Windows.Controls.Border.MeasureOverride上System.Windows.UIElement.Measure(Size availableSize)的System.Windows.FrameworkElement.MeasureCore(Size availableSize)上的System.Windows.Controls.ScrollViewer.MeasureOverride(Size constraint)处的ableSize) System.Windows.FrameworkElement.MeasureCore上System.Windows.Controls.Control.MeasureOverride(Size constraint)上System.Windows.UIElement.Measure(Size availableSize)的System.Windows.FrameworkElement.MeasureCore(Size availableSize)上的(大小约束) System.Windows.Controls.Grid.MeasureCell(Int32 cell,Boolean forceInfinityV)中的System.Windows.UIElement.Measure(Size availableSize)上的(size availableSize)System.Windows.Controls.Grid.MeasureCellsGroup(Int32 cellsHead,Size referenceSize,系统中的System.Windows.FrameworkElement.MeasureCore(Size availableSize)上的System.Windows.FrameworkElement.MeasureCore(Size availableSize)中的系统布局ignoreDesiredSizeU,布尔forceInfinityV)在Sys的System.Windows.UIElement.Measure(Size availableSize)tem.Windows.Controls.StackPanel.MeasureOverride(尺寸约束)在System.Windows.FrameworkElement.MeasureCore(尺码availableSize)在System.Windows.UIElement.Measure(尺码availableSize)在MS.Internal.Helper.MeasureElementWithSingleChild(的UIElement元件,尺寸System.Windows.Documents.AdasurenerDecorator.MeasureOverride上System.Windows.UIElement.Measure(Size availableSize)的System.Windows.FrameworkElement.MeasureCore(Size availableSize)上的System.Windows.Controls.ContentPresenter.MeasureOverride(Size约束)处理约束. System.Windows.FrameworkElement.MeasureCore上System.Windows.Controls.Border.MeasureOverride(Size constraint)的System.Windows.UIElement.Measure(Size availableSize)上的System.Windows.FrameworkElement.MeasureCore(Size availableSize)的(大小约束) System.Windows.Uasurelement.Measure(Size availableSize)的System.Windows.Uasurelement.Measure(Size availableSize)的大小(available availableSize)位于Syste的System.Windows.Window.MeasureOverride(Size availableSize)的System.Windows.WindOverrideHelper(Size constraint)System.Windows.Interop.HwndSource.set_RootVisualInternal(Visual value)at的System.Windows.Interop.HwndSource.SetLayoutSize()处的System.Windows.UIElement.Measure(Size availableSize)中的m.Windows.FrameworkElement.MeasureCore(Size availableSize) System.Windows.Interop.HwndSource.set_RootVisual(视觉值)System.Windows.Window.SetRootVisual()在System.Windows.Window.SetRootVisualAndUpdateSTC()在System.Windows.Window.SetupInitialState(双人间requestedTop,双requestedLeft,双requestedWidth ,双requestedHeight)在System.Windows.Window.CreateSourceWindow(布尔duringShow)在System.Windows.Window.CreateSourceWindowDuringShow()在System.Windows.Window.SafeCreateWindowDuringShow()在System.Windows.Window.ShowHelper(对象booleanBox)在系统.Windows.Window.Show()at
Alberstein.UI.View.MainView.Window.ShowDialog ()at Alberstein.UI.View.MainView.checkSyncstatus ()at Alberstein的Alberstein.UI.Views.MainView.menuWorkOnline_Click(Object sender,RoutedEventArgs e). UI.App.OnStartu p(Object sender,StartupEventArgs e)位于System.Windows.Application的System.Windows.Application.OnStartup(StartupEventArgs e).<.ctor> b__1(Object unused),位于System.Windows.Threading.ExceptionWrapper.InternalRealCall(委托回调, MS.Internal.Threading.ExceptionFilterHelper.TryCatchWhen(Object source,Delegate方法,Object args,Int32 numArgs,Delegate catchHandler)中的Object args,Int32 numArgs)

Tod*_*ddK 6

我遇到过同样的错误,问题出在Windows Presentation Foundation字体缓存服务上.它的缓存文件以某种方式被破坏.按照此MS知识库文章 http://support.microsoft.com/kb/937135中的说明,我能够解决问题.

这适用于3.0.0.0和4.0.0.0版本的Cache.

在我找到该文章之前,我刚刚停止并禁用了该服务,并且我的WPF应用程序正在启动.我怀疑禁用它会导致显示WPF应用程序的速度变慢(已经足够慢了),但是在现场有几台机器有这个问题之后,我禁用它并且从那时起就没有问题.