Home Dashboard Directory Help
Search

2012 SSMS System.Windows.Media.Fonts Exception On New Query by Don Jefe Leone


Status: 

Closed


1
1
Sign in
to vote
Type: Bug
ID: 779172
Opened: 2/13/2013 1:56:27 PM
Access Restriction: Public
1
Workaround(s)
view
2
User(s) can reproduce this bug

Description

SQL Server 2012 SP1

Clicking on the "New Query" button in SQL Management Studio 2012 produces the following exception, inside a messagebox (no other debug or stack information):

'The type initializer for System.Windows.Media.Fonts' threw an exception.'

See below for detailed information in "Actual Results".

Things already tried:

Reset Windows font settings to default.
Reset SSMS font settings to default.
Restart WPF font cache service.
Details
Sign in to post a comment.
Posted by Microsoft on 4/8/2013 at 10:53 AM
Hello Don. Based on the current status of workarounds for this issue, we will be marking it as resolved. If anyone finds the workarounds do not function, please post here and we will reactivate the item. -Walter A Jokiel, Program Manager, SQL Server (wajokiel@microsoft.com)
Posted by Microsoft on 2/21/2013 at 1:48 PM
Hello Don. Thank you for bringing this to our attention. We really do appreciate the feedback. We’ll investigate and get back to you. -Walter A Jokiel, Program Manager, SQL Server (wajokiel@microsoft.com)
Posted by Don Jefe Leone on 2/13/2013 at 1:56 PM
Stack Trace:


===================================

The type initializer for 'System.Windows.Media.Fonts' threw an exception. (mscorlib)

------------------------------
Program Location:

at Microsoft.VisualStudio.Editor.Implementation.VsFontsAndColorsInformation.GetWPFDefaultFontFamily()
at Microsoft.VisualStudio.Editor.Implementation.VsFontsAndColorsInformation.GetTypefaceFromFont(Font font, Boolean fontIsBold)
at Microsoft.VisualStudio.Editor.Implementation.VsFontsAndColorsInformation.GetPlainTextFont(IVsColorTable colorTable, FONTCOLORPREFERENCES2 fontColorPreferences)
at Microsoft.VisualStudio.Editor.Implementation.VsFontsAndColorsInformation.UpdatePlainTextProperties(IClassificationFormatMap classificationFormatMap, IEditorFormatMap editorFormatMap, UInt32 autoForeground, UInt32 autoBackground, IVsColorTable colorTable, FONTCOLORPREFERENCES2 fontColorPreferences)
at Microsoft.VisualStudio.Editor.Implementation.VsFontsAndColorsInformation.UpdatePlainTextProperties()
at Microsoft.VisualStudio.Editor.Implementation.VsFontAndColorInformationService.GetFontAndColorInformation(FontsAndColorsCategory fontsAndColorsCategory)
at Microsoft.VisualStudio.Editor.Implementation.VsTextViewAdapter.GetOrCreateFontsAndColorsInformation(FontsAndColorsCategory category)
at Microsoft.VisualStudio.Editor.Implementation.VsTextViewAdapter.Init_InitializeWpfTextView()
at Microsoft.VisualStudio.Editor.Implementation.VsTextViewAdapter.Init_OnActivation()
at Microsoft.VisualStudio.Editor.Implementation.VsTextViewAdapter.Init_OnTextBufferInitialized(Object sender, EventArgs e)
at System.EventHandler.Invoke(Object sender, EventArgs e)
at Microsoft.VisualStudio.Editor.Implementation.VsDocDataAdapter.RaiseTextBufferInitialized()
at Microsoft.VisualStudio.Editor.Implementation.VsTextBufferAdapter.NotifyOfTextBufferLoad(Boolean isReload)
at Microsoft.VisualStudio.Editor.Implementation.VsTextBufferAdapter.Load(String pszFilename, UInt32 grfMode, Int32 fReadOnly)
at Microsoft.VisualStudio.Editor.Implementation.VsTextBufferAdapter.LoadDocData(String pszMkDocument)
at System.Runtime.InteropServices.Marshal.ThrowExceptionForHRInternal(Int32 errorCode, IntPtr errorInfo)
at Microsoft.SqlServer.Management.UI.VSIntegration.Editors.ScriptFactory.CreateNewScript(String strFullPathToScript, IVsProject projectToAddScriptTo, UIConnectionGroupInfo connectionInfoList, IDbConnection liveCon, String rootName)
at Microsoft.SqlServer.Management.UI.VSIntegration.Editors.ScriptFactory.CreateNewScript(String strFullPathToScript, IVsExternalFilesManager extFileMgr, UIConnectionGroupInfo connectionInfoList, IDbConnection liveCon, String rootName)
at Microsoft.SqlServer.Management.UI.VSIntegration.Editors.ScriptFactory.CreateNewScript(String strFullPathToScript, UIConnectionGroupInfo connectionInfoList, IDbConnection liveCon, String fileRoot)
at Microsoft.SqlServer.Management.UI.VSIntegration.Editors.ScriptFactory.CreateNewScript(String strFullPathToScript, UIConnectionInfo ci, IDbConnection liveCon)
at Microsoft.SqlServer.Management.UI.VSIntegration.ObjectExplorer.NewQueryMenuHandler.Invoke()
at Microsoft.SqlServer.Management.UI.VSIntegration.ObjectExplorer.ToolsMenuItemBase.MenuInvokedHandler(Object sender, EventArgs args)

===================================

'' file does not conform to the expected file format specification. (PresentationCore)

------------------------------
Program Location:

at MS.Internal.FontFace.CompositeFontParser.FailNotWellFormed(Exception x)
at MS.Internal.FontFace.CompositeFontParser..ctor(Stream fileStream)
at MS.Internal.FontCache.FamilyCollection.SystemCompositeFonts.GetCompositeFontFamilyAtIndex(Int32 index)
at MS.Internal.FontCache.FamilyCollection.GetFontFamilies(Uri fontFamilyBaseUri, String fontFamilyLocationReference)
at System.Windows.Media.Fonts.CreateFamilyCollection(Uri fontLocation, Uri fontFamilyBaseUri, String fontFamilyLocationReference)
at System.Windows.Media.Fonts..cctor()

===================================

Invalid character in the given encoding. Line 1, position 1. (System.Xml)

------------------------------
Program Location:

at System.Xml.XmlTextReaderImpl.Throw(Exception e)
at System.Xml.XmlTextReaderImpl.Throw(String res, String arg)
at System.Xml.XmlTextReaderImpl.InvalidCharRecovery(Int32& bytesCount, Int32& charsCount)
at System.Xml.XmlTextReaderImpl.GetChars(Int32 maxCharsCount)
at System.Xml.XmlTextReaderImpl.ReadData()
at System.Xml.XmlTextReaderImpl.SwitchEncoding(Encoding newEncoding)
at System.Xml.XmlTextReaderImpl.ParseXmlDeclaration(Boolean isTextDecl)
at System.Xml.XmlTextReaderImpl.Read()
at System.Windows.Markup.XmlCompatibilityReader.Read()
at MS.Internal.FontFace.CompositeFontParser.MoveToContent()
at MS.Internal.FontFace.CompositeFontParser..ctor(Stream fileStream)

Sign in to post a workaround.
Posted by Don Jefe Leone on 2/14/2013 at 5:55 AM
I have found that if change the font for the "Text Editor" from the default of "Consolas" to something else (e.g. Lucida Console), this problem goes away.