none
An unhandled exception of type 'System.TypeInitializationException' occurred in PresentationCore.dll

    Question


  • Hi, there

    Something went wrong with my WinFX Runtime.
    My first error problem was that Visual Studio the Cider editor did not appeared and throw exception.

    Now the currect situation is that the Cider is not working and if I make a simple application with a one button on it like this:

    <Window x:Class="WindowsApplication2.Window1"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    Title="WindowsApplication2" Height="300" Width="300"
    >
    <Grid>
    <Button>Button</Button>
    </Grid>
    </Window>

    The application it will crash.

    It will crash with the folowing error messages:

    An unhandled exception of type 'System.TypeInitializationException' occurred in PresentationCore.dll

    Additional information: The type initializer for 'System.Windows.Media.FontFamily' threw an exception.

    It seams that somehow WinFX Runtime is failing.
    I have already tryed to uninstall and reinstall also repair WinFX Runtime Components 3.0 Beta 2 but no luck. The error would not go away.

    I did some extra investigation too. If I debug but set to halt at all exceptions then the first exception is at:

    A first chance exception of type 'System.ArgumentOutOfRangeException' occurred in mscorlib.dll

    Additional information: Not a valid Win32 FileTime.

    The stacktrace looks like this:
         mscorlib.dll!System.DateTime.FromFileTimeUtc(long fileTime) + 0xae bytes   
         mscorlib.dll!System.IO.File.GetLastWriteTimeUtc(string path) + 0xa3 bytes   
         mscorlib.dll!System.IO.Directory.GetLastWriteTimeUtc(string path) + 0x5 bytes   
         PresentationCore.dll!MS.Internal.FontCache.FontSource.GetLastWriteTimeUtc() + 0x9f bytes   
         PresentationCore.dll!MS.Internal.FontCache.FamilyCollection.AddPhysicalFamilyToList(MS.Internal.FontCache.FontSource fontSource = {MS.Internal.FontCache.FontSource}, System.Collections.Generic.List<MS.Internal.FontCache.FamilyCollection.BaseFamily> familyList = Count = 171, System.Collections.Generic.SortedDictionary<MS.Internal.FontCache.LocalizedName,MS.Internal.FontCache.FamilyCollection.BaseFamily> familyNameList = Count = 171, System.Collections.Generic.SortedList<string,object> frequentStrings = Count = 177) + 0x4fc bytes   
         PresentationCore.dll!MS.Internal.FontCache.FamilyCollection.BuildFamilyList(out System.Collections.Generic.List<MS.Internal.FontCache.FamilyCollection.BaseFamily> familyList = Count = 171, out System.Collections.Generic.SortedDictionary<MS.Internal.FontCache.LocalizedName,MS.Internal.FontCache.FamilyCollection.BaseFamily> familyNameList = Count = 171, out System.Collections.Generic.SortedList<string,object> frequentStrings = Count = 177) + 0x181 bytes   
         PresentationCore.dll!MS.Internal.FontCache.FamilyCollection.MS.Internal.FontCache.IFontCacheElement.AddToCache(MS.Internal.FontCache.CheckedPointer newPointer, MS.Internal.FontCache.ElementCacher cacher) + 0x95 bytes   
         PresentationCore.dll!MS.Internal.FontCache.HashTable.Lookup(MS.Internal.FontCache.IFontCacheElement e = {MS.Internal.FontCache.FamilyCollection}, bool add) + 0xf6 bytes   
         PresentationCore.dll!MS.Internal.FontCache.CacheManager.Lookup(MS.Internal.FontCache.IFontCacheElement e = {MS.Internal.FontCache.FamilyCollection}) + 0x9b bytes   
         PresentationCore.dll!System.Windows.Media.FontFamily.PreCreateDefaultFamilyCollection() + 0x33 bytes   
         PresentationCore.dll!System.Windows.Media.FontFamily.FontFamily() + 0x59 bytes   
         [Native to Managed Transition]   
         [Managed to Native Transition]   
         PresentationCore.dll!System.Windows.Media.Typeface.Typeface(System.Windows.Media.FontFamily fontFamily = {Tahoma}, System.Windows.FontStyle style, System.Windows.FontWeight weight, System.Windows.FontStretch stretch) + 0x25 bytes   
         PresentationFramework.dll!MS.Internal.Text.DynamicPropertyReader.GetTypeface(System.Windows.DependencyObject element) + 0xec bytes   
         PresentationFramework.dll!MS.Internal.Text.TextProperties.InitCommon(System.Windows.DependencyObject target = {System.Windows.Controls.TextBlock}) + 0xf bytes   
         PresentationFramework.dll!MS.Internal.Text.TextProperties.TextProperties(System.Windows.Controls.TextBlock target = {System.Windows.Controls.TextBlock}) + 0x41 bytes   
         PresentationFramework.dll!System.Windows.Controls.TextBlock.GetLineProperties() + 0x23 bytes   
         PresentationFramework.dll!System.Windows.Controls.TextBlock.EnsureTextBlockCache() + 0x30 bytes   
         PresentationFramework.dll!System.Windows.Controls.TextBlock.MeasureOverride(System.Windows.Size constraint) + 0x50 bytes   
         PresentationFramework.dll!System.Windows.FrameworkElement.MeasureCore(System.Windows.Size availableSize) + 0x1b0 bytes   
         PresentationCore.dll!System.Windows.UIElement.Measure(System.Windows.Size availableSize) + 0x218 bytes   
         PresentationFramework.dll!MS.Internal.Helper.MeasureSingleChild(System.Windows.UIElement child = {System.Windows.Controls.TextBlock}, System.Windows.Size constraint) + 0x3c bytes   
         PresentationFramework.dll!MS.Internal.Helper.MeasureElementWithSingleChild(System.Windows.UIElement element, System.Windows.Size constraint) + 0x42 bytes   
         PresentationFramework.dll!System.Windows.Controls.ContentPresenter.MeasureOverride(System.Windows.Size constraint) + 0x16 bytes   
         PresentationFramework.dll!System.Windows.FrameworkElement.MeasureCore(System.Windows.Size availableSize) + 0x1b0 bytes   
         PresentationCore.dll!System.Windows.UIElement.Measure(System.Windows.Size availableSize) + 0x218 bytes   
         PresentationFramework.Classic.dll!Microsoft.Windows.Themes.ClassicBorderDecorator.MeasureOverride(System.Windows.Size availableSize) + 0x106 bytes   
         PresentationFramework.dll!System.Windows.FrameworkElement.MeasureCore(System.Windows.Size availableSize) + 0x1b0 bytes   
         PresentationCore.dll!System.Windows.UIElement.Measure(System.Windows.Size availableSize) + 0x218 bytes   
         PresentationFramework.dll!System.Windows.Controls.Control.MeasureOverride(System.Windows.Size constraint) + 0x57 bytes   
         PresentationFramework.dll!System.Windows.FrameworkElement.MeasureCore(System.Windows.Size availableSize) + 0x1b0 bytes   
         PresentationCore.dll!System.Windows.UIElement.Measure(System.Windows.Size availableSize) + 0x218 bytes   
         PresentationFramework.dll!System.Windows.Controls.Grid.MeasureOverride(System.Windows.Size constraint) + 0xa8 bytes   
         PresentationFramework.dll!System.Windows.FrameworkElement.MeasureCore(System.Windows.Size availableSize) + 0x1b0 bytes   
         PresentationCore.dll!System.Windows.UIElement.Measure(System.Windows.Size availableSize) + 0x218 bytes   
         PresentationFramework.dll!MS.Internal.Helper.MeasureSingleChild(System.Windows.UIElement child = {System.Windows.Controls.Grid}, System.Windows.Size constraint) + 0x3c bytes   
         PresentationFramework.dll!MS.Internal.Helper.MeasureElementWithSingleChild(System.Windows.UIElement element, System.Windows.Size constraint) + 0x42 bytes   
         PresentationFramework.dll!System.Windows.Controls.ContentPresenter.MeasureOverride(System.Windows.Size constraint) + 0x16 bytes   
         PresentationFramework.dll!System.Windows.FrameworkElement.MeasureCore(System.Windows.Size availableSize) + 0x1b0 bytes   
         PresentationCore.dll!System.Windows.UIElement.Measure(System.Windows.Size availableSize) + 0x218 bytes   
         PresentationFramework.dll!System.Windows.Controls.Decorator.MeasureOverride(System.Windows.Size constraint) + 0x42 bytes   
         PresentationFramework.dll!System.Windows.Documents.AdornerDecorator.MeasureOverride(System.Windows.Size constraint) + 0x39 bytes   
         PresentationFramework.dll!System.Windows.FrameworkElement.MeasureCore(System.Windows.Size availableSize) + 0x1b0 bytes   
         PresentationCore.dll!System.Windows.UIElement.Measure(System.Windows.Size availableSize) + 0x218 bytes   
         PresentationFramework.dll!System.Windows.Controls.Grid.MeasureCell(int cell, bool forceInfinityV) + 0x16a bytes   
         PresentationFramework.dll!System.Windows.Controls.Grid.MeasureCellsGroup(int cellsHead, System.Windows.Size referenceSize, bool ignoreDesiredSizeU = false, bool forceInfinityV = false) + 0x61 bytes   
         PresentationFramework.dll!System.Windows.Controls.Grid.MeasureOverride(System.Windows.Size constraint) + 0x464 bytes   
         PresentationFramework.dll!System.Windows.FrameworkElement.MeasureCore(System.Windows.Size availableSize) + 0x1b0 bytes   
         PresentationCore.dll!System.Windows.UIElement.Measure(System.Windows.Size availableSize) + 0x218 bytes   
         PresentationFramework.dll!System.Windows.Controls.Border.MeasureOverride(System.Windows.Size constraint) + 0x137 bytes   
         PresentationFramework.dll!System.Windows.FrameworkElement.MeasureCore(System.Windows.Size availableSize) + 0x1b0 bytes   
         PresentationCore.dll!System.Windows.UIElement.Measure(System.Windows.Size availableSize) + 0x218 bytes   
         PresentationFramework.dll!System.Windows.Window.MeasureOverrideHelper(System.Windows.Size constraint) + 0x137 bytes   
         PresentationFramework.dll!System.Windows.Window.MeasureOverride(System.Windows.Size availableSize) + 0xe2 bytes   
         PresentationFramework.dll!System.Windows.FrameworkElement.MeasureCore(System.Windows.Size availableSize) + 0x5a bytes   
         PresentationCore.dll!System.Windows.UIElement.Measure(System.Windows.Size availableSize) + 0x218 bytes   
         PresentationCore.dll!System.Windows.Interop.HwndSource.SetLayoutSize() + 0xca bytes   
         PresentationCore.dll!System.Windows.Interop.HwndSource.RootVisualInternal.set(System.Windows.Media.Visual value) + 0x15a bytes   
         PresentationCore.dll!System.Windows.Interop.HwndSource.RootVisual.set(System.Windows.Media.Visual value) + 0x1b bytes   
         PresentationFramework.dll!System.Windows.Window.SetupInitialState(double requestedTop, double requestedLeft, double requestedWidth, double requestedHeight) + 0x78f bytes   
         PresentationFramework.dll!System.Windows.Window.CreateSourceWindowImpl() + 0x238 bytes   
         PresentationFramework.dll!System.Windows.Window.SafeCreateWindow() + 0x3c bytes   
         PresentationFramework.dll!System.Windows.Window.ShowHelper(object booleanBox) + 0x56 bytes   
         WindowsBase.dll!System.Windows.Threading.ExceptionWrapper.InternalRealCall(System.Delegate callback = {System.Windows.Threading.DispatcherOperationCallback}, object args = true, bool isSingleParameter = true) + 0x4a bytes   
         WindowsBase.dll!System.Windows.Threading.ExceptionWrapper.TryCatchWhen(object source = {System.Windows.Threading.Dispatcher}, System.Delegate callback, object args, bool isSingleParameter, System.Delegate catchHandler = null) + 0x3f bytes   
         WindowsBase.dll!System.Windows.Threading.DispatcherOperation.InvokeImpl() + 0xf6 bytes   
         WindowsBase.dll!System.Windows.Threading.DispatcherOperation.InvokeInSecurityContext(object state) + 0x28 bytes   
         mscorlib.dll!System.Threading.ExecutionContext.runTryCode(object userData) + 0x43 bytes   
         [Native to Managed Transition]   
         [Managed to Native Transition]   
         mscorlib.dll!System.Threading.ExecutionContext.RunInternal(System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, object state) + 0xa7 bytes   
         mscorlib.dll!System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, object state) + 0x92 bytes   
         WindowsBase.dll!System.Windows.Threading.DispatcherOperation.Invoke() + 0x48 bytes   
         WindowsBase.dll!System.Windows.Threading.Dispatcher.ProcessQueue() + 0x110 bytes   
         WindowsBase.dll!System.Windows.Threading.Dispatcher.WndProcHook(System.IntPtr hwnd, int msg, System.IntPtr wParam, System.IntPtr lParam, ref bool handled) + 0x6a bytes   
         WindowsBase.dll!MS.Win32.HwndWrapper.WndProc(System.IntPtr hwnd = 787590, int msg = 49515, System.IntPtr wParam = 0, System.IntPtr lParam = 0, ref bool handled = false) + 0x87 bytes   
         WindowsBase.dll!MS.Win32.HwndSubclass.DispatcherCallbackOperation(object o) + 0x10f bytes   
         WindowsBase.dll!System.Windows.Threading.ExceptionWrapper.InternalRealCall(System.Delegate callback = {System.Windows.Threading.DispatcherOperationCallback}, object args = {Dimensions:[4]}, bool isSingleParameter = true) + 0x4a bytes   
         WindowsBase.dll!System.Windows.Threading.ExceptionWrapper.TryCatchWhen(object source = {System.Windows.Threading.Dispatcher}, System.Delegate callback, object args, bool isSingleParameter, System.Delegate catchHandler = null) + 0x3f bytes   
         WindowsBase.dll!System.Windows.Threading.Dispatcher.InvokeImpl(System.Windows.Threading.DispatcherPriority priority, System.TimeSpan timeout, System.Delegate method, object args, bool isSingleParameter) + 0x140 bytes   
         WindowsBase.dll!System.Windows.Threading.Dispatcher.Invoke(System.Windows.Threading.DispatcherPriority priority, System.Delegate method, object arg) + 0x3d bytes   
         WindowsBase.dll!MS.Win32.HwndSubclass.SubclassWndProc(System.IntPtr hwnd = 787590, int msg = 49515, System.IntPtr wParam = 0, System.IntPtr lParam = 0) + 0x196 bytes   
         [Native to Managed Transition]   
         [Managed to Native Transition]   
         WindowsBase.dll!System.Windows.Threading.Dispatcher.PushFrameImpl(System.Windows.Threading.DispatcherFrame frame = {System.Windows.Threading.DispatcherFrame}) + 0x147 bytes   
         WindowsBase.dll!System.Windows.Threading.Dispatcher.PushFrame(System.Windows.Threading.DispatcherFrame frame) + 0x83 bytes   
         WindowsBase.dll!System.Windows.Threading.Dispatcher.Run() + 0x75 bytes   
         PresentationFramework.dll!System.Windows.Application.RunInternal(System.Windows.Window window) + 0x83 bytes   
         PresentationFramework.dll!System.Windows.Application.Run(System.Windows.Window window) + 0x29 bytes   
         PresentationFramework.dll!System.Windows.Application.Run() + 0x22 bytes   
    >    WindowsApplication2.exe!WindowsApplication2.App.Main() Line 50 + 0x9 bytes    C#


    It used to work at the begining but something went wrong during the time.

    Anybody experienced something like this?

    Friday, June 30, 2006 7:40 PM

Answers

  • Well it seams that I was able to solve the problem and now I can run the application.
    The problem was caused that I install a Zapfino font because I for some other work that I did form one of my relative.
    I do not know how this font was able to influence WinFX or MS MS.Internal.FontCache but it after I deleted I was able to run the application but now my Visual Studio WinFX wizards do not work.
    Friday, June 30, 2006 8:06 PM
  • Now the Visual Studio works too.
    The problem was that it needed Visual Studio 2005 Extensions for Windows Workflow Foundation Beta too. The solution did not contained code or project related to WWF. I do not know why it did not wanted to run, but now all runs so I do not care. :-)
    Friday, June 30, 2006 8:13 PM

All replies

  • Well it seams that I was able to solve the problem and now I can run the application.
    The problem was caused that I install a Zapfino font because I for some other work that I did form one of my relative.
    I do not know how this font was able to influence WinFX or MS MS.Internal.FontCache but it after I deleted I was able to run the application but now my Visual Studio WinFX wizards do not work.
    Friday, June 30, 2006 8:06 PM
  • Now the Visual Studio works too.
    The problem was that it needed Visual Studio 2005 Extensions for Windows Workflow Foundation Beta too. The solution did not contained code or project related to WWF. I do not know why it did not wanted to run, but now all runs so I do not care. :-)
    Friday, June 30, 2006 8:13 PM
  • I had the exact same problem (TypeInitializationException), and managed to solve it the same way.

    I read E. Laszlo's suggestion, went into c:\windows\fonts, sorted by date modified, and started removing the most recently added (I've added probably 10 since I installed Windows). I deleted probably the last three, and this seemed to make the problem go away.

    I'll try to find out which font it was (didn't bother taking note as this problem has put me behind with work!)

    I'd be interested to see what it was about the font(s) that made the FontFamily initializer die...

    Coolus
    Saturday, June 20, 2009 5:43 AM