Exception when installing Visual Studio 2012 Update 3

When I try to install Visual Studio 2012 Update 3, the installer immediately crashes:

image

Looking at the Log File that was created, I can see it’s related to Fonts:

[14D8:1218][2013-06-27T02:40:58]: MUX:  Exception: Info: InnerException: Info:
[14D8:1218][2013-06-27T02:40:58]: MUX:  ERROR: Not a valid Win32 FileTime.
Parameter name: fileTime
[14D8:1218][2013-06-27T02:40:58]: MUX:  Stack:    at System.DateTime.FromFileTimeUtc(Int64 fileTime)
   at System.IO.File.GetLastWriteTimeUtc(String path)
   at System.IO.Directory.GetLastWriteTimeUtc(String path)
   at MS.Internal.FontCache.FontSource.GetLastWriteTimeUtc()
   at MS.Internal.FontCache.FamilyCollection.AddPhysicalFamilyToList(FontSource fontSource, List`1 familyList, SortedDictionary`2 familyNameList, SortedList`2 frequentStrings)
   at MS.Internal.FontCache.FamilyCollection.BuildFamilyList(List`1& familyList, SortedDictionary`2& familyNameList, SortedList`2& frequentStrings)
   at MS.Internal.FontCache.FamilyCollection.MS.Internal.FontCache.IFontCacheElement.AddToCache(CheckedPointer newPointer, ElementCacher cacher)
   at MS.Internal.FontCache.HashTable.Lookup(IFontCacheElement e, Boolean add)
   at MS.Internal.FontCache.CacheManager.Lookup(IFontCacheElement e)
   at System.Windows.Media.FontFamily.PreCreateDefaultFamilyCollection()
   at System.Windows.Media.FontFamily..cctor()

So one of my fonts is crashing for whatever reason. I wrote a small console app to find out which font:

void Main()
{
    string str = Environment.GetEnvironmentVariable("windir") + @"\Fonts\";
    var _windowsFontsLocalPath = str.ToUpperInvariant();

    using(var key = Registry.LocalMachine.OpenSubKey(@"SOFTWARE\Microsoft\Windows NT\CurrentVersion\Fonts")){
        foreach(var value in key.GetValueNames()){
            var name = key.GetValue(value) as string;
            var fullName = name.Contains("\\") ? name : Path.Combine(_windowsFontsLocalPath, name);
	
            if(!File.Exists(fullName)){
                Console.WriteLine("Font doesn't exist: {0}", fullName);
            }

            try {
                File.GetLastWriteTimeUtc(fullName);
            } catch (Exception ex){
                Console.WriteLine("Exception accessing {0}: [{1}] {2}", fullName, ex.GetType().Name, ex.Message);
            }			
        }
    }
    Console.WriteLine("Done");
}

The output showed a broken font:

Exception accessing C:\WINDOWS\FONTS\Exo-Thin.otf: [ArgumentOutOfRangeException] Not a valid Win32 FileTime.

C:\Windows\Fonts>dir exo-thin.otf
  Directory of C:\Windows\Fonts

02/05/22705  11:03 AM           104,912 Exo-Thin.otf

So apparently I have a font from the future that causes WPF to crash. Why? Not sure, could be an indication of a hard drive crash or some other sort of corruption. I ended up fixing it with a one-liner:

File.SetLastWriteTimeUtc(@"c:\windows\fonts\Exo-Thin.otf", DateTime.UtcNow);

After that change, Visual Studio Update 3 installed without issue.