自从我将 Windows 升级到 2019 年 5 月 (1903) 版本以来,SQL Server Management Studio 18.1 在启动时一直抛出错误。当我使用 -log 选项启动它时,我收到了数百个错误报告,例如:
<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>
当 SSMS 最终加载时,我之前访问的数据库列表消失了,并且缺少 UI 元素,如下所示:
我已采取的步骤:
我已经采取了其他步骤并重复了这个过程几次 - 每次都好像大量的支持包和组件丢失或放置不正确。我没有更改计算机上的任何驱动器号,据我所知,没有任何内容依赖于网络位置。
没有重新安装Windows,我不知所措。
更新:我尝试安装 SSMS 18.0,它工作 100% 正常。所以这是特定于 Windows 版本 1903 上的 18.1(10.0.18362 Build 18362)
TL;DR 这是解决方案: 尽管听起来很荒谬,但在我创建
Documents\SQL Server Management Studio
文件夹后,错误消失了,并且返回了丢失的 UI 元素。到目前为止一切正常(祈祷)。
详情
过去几天我遇到了类似的问题,日志中出现很多“正在加载 UI 库”错误,并且在启动时和许多设备上弹出“程序包 Microsoft.SqlServer.Management.SqlStudio 无法正确加载”错误消息用户操作(例如打开连接对话框,甚至从“帮助”菜单中打开“关于”窗口)。
无论如何,我刚刚在日志的最底部注意到的一件事是(我不知道你是否也有):
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)
现在,由于我没有主意(修复/重新安装 SSMS 没有帮助,删除 SSMS 注册表项没有帮助,而且我不打算重新安装 Windows),我决定继续手动创建该路径正在尝试访问。
附注如果您认为它可能想将一些文件写入该文件夹,那么您就错了。该文件夹仍然是空的......它只是坐在那里。我喜欢认为这让 SSMS 感觉很舒服。 另外,我无法告诉您如果非常需要该文件夹,它是如何无法创建该文件夹的。当然它有访问权限,特别是考虑到我确实多次尝试使用管理员权限运行它,因为我试图让它工作。
我的经历与 Vlad 略有不同,所以我想分享一下,希望能帮助其他人。
ActivityLog.xml
确实引用了一个文件,在我的例子中,user.config
第6行。该文件有 5 行有效数据,其余部分为垃圾数据。 user.config
对我来说位于这里:
C:\Users\me\AppData\Local\Microsoft_Corporation\DefaultDomain_Url_315jocyprgycyaf1bv5fxwi31zcufzj1\15.0.18183.0\user.config
15.0.18183 用于 SSMS 18.3 我还为 SSMS 18.1 安装了 15.0.18131?不管怎样,15.0.18131 文件夹都有一个有效的
user.config
,所以我只是用好的文件夹覆盖了坏的文件夹。重新启动 SSMS 18.3,一切按预期工作。
我还怀疑这就是 Jeff Dalley 在 SSMS 18.1 无法工作时能够使用 SSMS 18.0 的原因。可能是因为他的 18.1
user.config
是 FUBAR,而他的 18.0 user.config
是干净的。当您卸载 SSMS 18.x 时,该文件也不会被删除,因此修复或卸载/重新安装无法解决问题。
这里是完整的相关错误消息,如果微软的人可以解决这个问题,那就太棒了!
<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>