Since I upgraded Windows to the May 2019 (1903) release, SQL Server Management Studio 18.1 has been throwing errors on startup. When I launch it with the -log option, I get a few hundred errors reported like:
<type>Error</type>
<source>VisualStudio</source>
<description>Loading UI library</description>
<guid>{198E76C1-34C0-424D-9957-B3EBD80265FB}</guid>
<hr>800a006f</hr>
...
<type>Error</type>
<source>VisualStudio</source>
<description>Error loading UI library for package (null).HrLoadNativeUILibrary failed with 0x800a006f.</description>
...
<type>Error</type>
<source>VisualStudio</source>
<description>LegacySitePackage failed for package [Management Studio Update Checker]Source: ...</description>
<guid>{A370BC08-51DD-4F09-8386-8F31E8704796}</guid>
<hr>80131534</hr>
...
<type>Error</type>
<source>VisualStudio</source>
<description>SetSite failed for package [Management Studio Update Checker](null)</description>
<guid>{A370BC08-51DD-4F09-8386-8F31E8704796}</guid>
<hr>80131534</hr>
When SSMS finally loads, my list of databases previously accessed is gone, and there are UI elements missing like this:

Steps I've taken:
I've taken other steps and repeated this process a handful of times - every time it's as though a large number of supporting packages and assemblies missing or incorrectly placed. I have not changed any drive letters on my machine and as far as I'm aware nothing is dependent on a network location.
Short of reinstalling Windows, I'm at a loss.
Update: I tried installing SSMS 18.0, and it works 100% fine. So this is specific to 18.1 on Windows Version 1903 (10.0.18362 Build 18362)
TL;DR Here is the solution: As ridiculous as it may sound, after I created a Documents\SQL Server Management Studio folder, the errors disappeared and the missing UI elements returned. It's been working fine so far (fingers crossed).
Details
I was having a similar issue the past few days, with a lot of "Loading UI library" errors in the log and a "Package Microsoft.SqlServer.Management.SqlStudio failed to load properly" error message popping up on startup and on many user actions (such as opening the connection dialog, or even About window from Help menu).
Anyway, one thing that I just noticed at the very bottom of my log was (and I don't know if you have it too):
Could not find file 'C:\Users\vs\Documents\SQL Server Management Studio'. System.IO.FileNotFoundException: Could not find file 'C:\Users\vs\Documents\SQL Server Management Studio'. File name: 'C:\Users\vs\Documents\SQL Server Management Studio' at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath) at System.IO.Directory.InternalCreateDirectory(String fullPath, String path, Object dirSecurityObj, Boolean checkHost) at System.IO.Directory.InternalCreateDirectoryHelper(String path, Boolean checkHost) at System.IO.Directory.CreateDirectory(String path) at Microsoft.SqlServer.Management.SqlStudio.SetDefaultProjectOpenLocation() at Microsoft.SqlServer.Management.SqlStudio.SetupInitialShellSettings() at Microsoft.SqlServer.Management.SqlStudio.Initialize() at Microsoft.VisualStudio.Shell.Package.Microsoft.VisualStudio.Shell.Interop.IVsPackage.SetSite(IServiceProvider sp)
Now, since I was out of ideas (repairing/reinstalling SSMS didn't help, removing the SSMS registry keys didn't help, and I was not about to reinstall Windows), I decided to go ahead and manually create that path it was trying to access.
P.S. If you think it wanted to maybe write some files into that folder, you'd be mistaken. The folder remains empty... It's just sitting there. I like to think it makes SSMS feel comfortable. Also, I can't tell you how it failed to create the folder if it needed it so much. Sure it has access, especially considering that I did try to run it with Admin privileges more than once as I was trying to make it work.
I had a slightly different experience than Vlad so I thought I'd share to hopefully help others.
I found my user.config corrupted and replaced it with the previous versions.
The ActivityLog.xml did reference that a file, user.config line 6 in my case. The file had 5 lines of good data and then garbage for the remainder of the file. user.config is located here for me:
C:\Users\me\AppData\Local\Microsoft_Corporation\DefaultDomain_Url_315jocyprgycyaf1bv5fxwi31zcufzj1\15.0.18183.0\user.config
The 15.0.18183 is for SSMS 18.3 I also had installed 15.0.18131 for SSMS 18.1? Either way the 15.0.18131 folder had a valid user.config, so I just overwrote the bad one with the good one. Restarted SSMS 18.3 and everything worked as expected.
I also suspect this is why Jeff Dalley was able to use SSMS 18.0 when SSMS 18.1 was not working. Probably because his 18.1 user.config was FUBAR while his 18.0 user.config was clean. This file also isn't deleted when you uninstall SSMS 18.x so a repair or uninstall/reinstall would not fix the issue.
Here is the entire relevant error message if someone from Microsoft can fix this, that would be awesome!
<entry>
<record>146</record>
<time>2019/10/16 13:51:21.206</time>
<type>Error</type>
<source>VisualStudio</source>
<description>LegacySitePackage failed for package [Management Studio Update Checker]Source: 'Microsoft.SqlServer.Management.UpdateChecker' Description: The type initializer for 'Microsoft.SqlServer.Management.UpdateChecker.UI.DataPackageProfile' threw an exception.
System.TypeInitializationException: The type initializer for 'Microsoft.SqlServer.Management.UpdateChecker.UI.DataPackageProfile' threw an exception. ---> System.Configuration.ConfigurationErrorsException: Configuration system failed to initialize ---> System.Configuration.ConfigurationErrorsException: '.', hexadecimal value 0x00, is an invalid character. Line 6, position 1. (C:\Users\me\AppData\Local\Microsoft_Corporation\DefaultDomain_Url_315jocyprgycyaf1bv5fxwi31zcufzj1\15.0.18183.0\user.config line 6) ---> System.Xml.XmlException: '.', hexadecimal value 0x00, is an invalid character. Line 6, position 1.
 at System.Xml.XmlTextReaderImpl.Throw(Exception e)
 at System.Xml.XmlTextReaderImpl.Throw(String res, String[] args)
 at System.Xml.XmlTextReaderImpl.ParseText(Int32& startPos, Int32& endPos, Int32& outOrChars)
 at System.Xml.XmlTextReaderImpl.ParseText()
 at System.Xml.XmlTextReaderImpl.ParseElementContent()
 at System.Xml.XmlTextReaderImpl.Read()
 at System.Xml.XmlTextReader.Read()
 at System.Configuration.XmlUtil.StrictReadToNextElement(ExceptionAction action)
 at System.Configuration.BaseConfigurationRecord.ScanFactoriesRecursive(XmlUtil xmlUtil, String parentConfigKey, Hashtable factoryList)
 at System.Configuration.BaseConfigurationRecord.ScanFactoriesRecursive(XmlUtil xmlUtil, String parentConfigKey, Hashtable factoryList)
 at System.Configuration.BaseConfigurationRecord.ScanFactories(XmlUtil xmlUtil)
 at System.Configuration.BaseConfigurationRecord.InitConfigFromFile()
 --- End of inner exception stack trace ---
 at System.Configuration.ConfigurationSchemaErrors.ThrowIfErrors(Boolean ignoreLocal)
 at System.Configuration.BaseConfigurationRecord.ThrowIfParseErrors(ConfigurationSchemaErrors schemaErrors)
 at System.Configuration.BaseConfigurationRecord.ThrowIfInitErrors()
 at System.Configuration.ClientConfigurationSystem.OnConfigRemoved(Object sender, InternalConfigEventArgs e)
 --- End of inner exception stack trace ---
 at System.Configuration.ConfigurationManager.PrepareConfigSystem()
 at System.Configuration.ConfigurationManager.GetSection(String sectionName)
 at System.Configuration.PrivilegedConfigurationManager.GetSection(String sectionName)
 at System.Diagnostics.DiagnosticsConfiguration.GetConfigSection()
 at System.Diagnostics.DiagnosticsConfiguration.Initialize()
 at System.Diagnostics.DiagnosticsConfiguration.get_Sources()
 at System.Diagnostics.TraceSource.Initialize()
 at Microsoft.SqlServer.Diagnostics.STrace.STraceSource.Initialize()
 at Microsoft.SqlServer.Diagnostics.STrace.STraceSource..ctor(String name)
 at Microsoft.SqlServer.Diagnostics.STrace.STraceSourceCollection.get_Item(String sourceName)
 at Microsoft.SqlServer.Diagnostics.STrace.TraceContext.GetTraceContext(String eventSourceName, String eventContext)
 at Microsoft.SqlServer.Management.UpdateChecker.UI.DataPackageProfile..cctor()
 --- End of inner exception stack trace ---
 at Microsoft.SqlServer.Management.UpdateChecker.UI.DataPackageProfile.Initialize()
 at Microsoft.VisualStudio.Shell.Package.Microsoft.VisualStudio.Shell.Interop.IVsPackage.SetSite(IServiceProvider sp)System.Configuration.ConfigurationErrorsException: Configuration system failed to initialize ---> System.Configuration.ConfigurationErrorsException: '.', hexadecimal value 0x00, is an invalid character. Line 6, position 1. (C:\Users\me\AppData\Local\Microsoft_Corporation\DefaultDomain_Url_315jocyprgycyaf1bv5fxwi31zcufzj1\15.0.18183.0\user.config line 6) ---> System.Xml.XmlException: '.', hexadecimal value 0x00, is an invalid character. Line 6, position 1.
 at System.Xml.XmlTextReaderImpl.Throw(Exception e)
 at System.Xml.XmlTextReaderImpl.Throw(String res, String[] args)
 at System.Xml.XmlTextReaderImpl.ParseText(Int32& startPos, Int32& endPos, Int32& outOrChars)
 at System.Xml.XmlTextReaderImpl.ParseText()
 at System.Xml.XmlTextReaderImpl.ParseElementContent()
 at System.Xml.XmlTextReaderImpl.Read()
 at System.Xml.XmlTextReader.Read()
 at System.Configuration.XmlUtil.StrictReadToNextElement(ExceptionAction action)
 at System.Configuration.BaseConfigurationRecord.ScanFactoriesRecursive(XmlUtil xmlUtil, String parentConfigKey, Hashtable factoryList)
 at System.Configuration.BaseConfigurationRecord.ScanFactoriesRecursive(XmlUtil xmlUtil, String parentConfigKey, Hashtable factoryList)
 at System.Configuration.BaseConfigurationRecord.ScanFactories(XmlUtil xmlUtil)
 at System.Configuration.BaseConfigurationRecord.InitConfigFromFile()
 --- End of inner exception stack trace ---
 at System.Configuration.ConfigurationSchemaErrors.ThrowIfErrors(Boolean ignoreLocal)
 at System.Configuration.BaseConfigurationRecord.ThrowIfParseErrors(ConfigurationSchemaErrors schemaErrors)
 at System.Configuration.BaseConfigurationRecord.ThrowIfInitErrors()
 at System.Configuration.ClientConfigurationSystem.OnConfigRemoved(Object sender, InternalConfigEventArgs e)
 --- End of inner exception stack trace ---
 at System.Configuration.ConfigurationManager.PrepareConfigSystem()
 at System.Configuration.ConfigurationManager.GetSection(String sectionName)
 at System.Configuration.PrivilegedConfigurationManager.GetSection(String sectionName)
 at System.Diagnostics.DiagnosticsConfiguration.GetConfigSection()
 at System.Diagnostics.DiagnosticsConfiguration.Initialize()
 at System.Diagnostics.DiagnosticsConfiguration.get_Sources()
 at System.Diagnostics.TraceSource.Initialize()
 at Microsoft.SqlServer.Diagnostics.STrace.STraceSource.Initialize()
 at Microsoft.SqlServer.Diagnostics.STrace.STraceSource..ctor(String name)
 at Microsoft.SqlServer.Diagnostics.STrace.STraceSourceCollection.get_Item(String sourceName)
 at Microsoft.SqlServer.Diagnostics.STrace.TraceContext.GetTraceContext(String eventSourceName, String eventContext)
 at Microsoft.SqlServer.Management.UpdateChecker.UI.DataPackageProfile..cctor()System.Configuration.ConfigurationErrorsException: '.', hexadecimal value 0x00, is an invalid character. Line 6, position 1. (C:\Users\me\AppData\Local\Microsoft_Corporation\DefaultDomain_Url_315jocyprgycyaf1bv5fxwi31zcufzj1\15.0.18183.0\user.config line 6) ---> System.Xml.XmlException: '.', hexadecimal value 0x00, is an invalid character. Line 6, position 1.
 at System.Xml.XmlTextReaderImpl.Throw(Exception e)
 at System.Xml.XmlTextReaderImpl.Throw(String res, String[] args)
 at System.Xml.XmlTextReaderImpl.ParseText(Int32& startPos, Int32& endPos, Int32& outOrChars)
 at System.Xml.XmlTextReaderImpl.ParseText()
 at System.Xml.XmlTextReaderImpl.ParseElementContent()
 at System.Xml.XmlTextReaderImpl.Read()
 at System.Xml.XmlTextReader.Read()
 at System.Configuration.XmlUtil.StrictReadToNextElement(ExceptionAction action)
 at System.Configuration.BaseConfigurationRecord.ScanFactoriesRecursive(XmlUtil xmlUtil, String parentConfigKey, Hashtable factoryList)
 at System.Configuration.BaseConfigurationRecord.ScanFactoriesRecursive(XmlUtil xmlUtil, String parentConfigKey, Hashtable factoryList)
 at System.Configuration.BaseConfigurationRecord.ScanFactories(XmlUtil xmlUtil)
 at System.Configuration.BaseConfigurationRecord.InitConfigFromFile()
 --- End of inner exception stack trace ---
 at System.Configuration.ConfigurationSchemaErrors.ThrowIfErrors(Boolean ignoreLocal)
 at System.Configuration.BaseConfigurationRecord.ThrowIfParseErrors(ConfigurationSchemaErrors schemaErrors)
 at System.Configuration.BaseConfigurationRecord.ThrowIfInitErrors()
 at System.Configuration.ClientConfigurationSystem.OnConfigRemoved(Object sender, InternalConfigEventArgs e)System.Xml.XmlException: '.', hexadecimal value 0x00, is an invalid character. Line 6, position 1.
 at System.Xml.XmlTextReaderImpl.Throw(Exception e)
 at System.Xml.XmlTextReaderImpl.Throw(String res, String[] args)
 at System.Xml.XmlTextReaderImpl.ParseText(Int32& startPos, Int32& endPos, Int32& outOrChars)
 at System.Xml.XmlTextReaderImpl.ParseText()
 at System.Xml.XmlTextReaderImpl.ParseElementContent()
 at System.Xml.XmlTextReaderImpl.Read()
 at System.Xml.XmlTextReader.Read()
 at System.Configuration.XmlUtil.StrictReadToNextElement(ExceptionAction action)
 at System.Configuration.BaseConfigurationRecord.ScanFactoriesRecursive(XmlUtil xmlUtil, String parentConfigKey, Hashtable factoryList)
 at System.Configuration.BaseConfigurationRecord.ScanFactoriesRecursive(XmlUtil xmlUtil, String parentConfigKey, Hashtable factoryList)
 at System.Configuration.BaseConfigurationRecord.ScanFactories(XmlUtil xmlUtil)
 at System.Configuration.BaseConfigurationRecord.InitConfigFromFile()</description>
<guid>{A370BC08-51DD-4F09-8386-8F31E8704796}</guid>
<hr>80131534</hr>
<errorinfo></errorinfo>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With