You need to enable JavaScript to run this app. SSMS v18.5.1新建Analysis Services DAX查询报“未将对象引用设置到对象实例”错误
优惠活动
大模型
产品
解决方案
定价
更多

SSMS v18.5.1新建Analysis Services DAX查询报“未将对象引用设置到对象实例”错误

问题概述

我在SQL Server Management Studio(SSMS)v18.5.1版本中无法新建 Analysis Services DAX 查询,报错截图参考用户上传的本地附件。
错误详情如下:

Failed to create new DAX script.
------------------------------
ADDITIONAL INFORMATION:
Object reference not set to an instance of an object.
   at Microsoft.VisualStudio.Text.Editor.Implementation.WpfTextView.UnsubscribeFromEvents()
   at Microsoft.VisualStudio.Text.Editor.Implementation.WpfTextView.Close()
   at Microsoft.VisualStudio.Text.Editor.Implementation.WpfTextViewHost.Close()
   at Microsoft.VisualStudio.Editor.Implementation.SimpleTextViewWindow.CloseExistingWpfTextView()
   at Microsoft.VisualStudio.Editor.Implementation.SimpleTextViewWindow.CloseBufferRelatedResources()
   at Microsoft.VisualStudio.Editor.Implementation.SimpleTextViewWindow.CloseView()
   at Microsoft.VisualStudio.Editor.Implementation.CompoundTextViewWindow.Close()
   at Microsoft.SqlServer.Management.UI.VSIntegration.ShellCodeWindowControl.UnsinkEventsAndFreeInterfaces()
   at Microsoft.SqlServer.Management.UI.VSIntegration.ShellTextEditorControl.Dispose(Boolean disposing)
   at System.ComponentModel.Component.Dispose()
   at Microsoft.SqlServer.Management.UI.VSIntegration.Editors.ScriptEditorControl.Dispose(Boolean bDisposing)
   at Microsoft.SqlServer.Management.UI.VSIntegration.Editors.ScriptAndResultsEditorControl.Dispose(Boolean bDisposing)
   at Microsoft.SqlServer.Management.UI.VSIntegration.Editors.MdxScriptEditorControl.Dispose(Boolean bDisposing)
   at Microsoft.SqlServer.Management.UI.VSIntegration.ShellWindowPaneUserControl.OnWindowPaneClose()
   at Microsoft.SqlServer.Management.UI.VSIntegration.ShellWindowPaneUserControl.ClosePane()
   at Microsoft.VisualStudio.Platform.WindowManagement.WindowPaneDocumentObject.<>c__DisplayClass19_0.<DisposeManagedResources>b__0()
   at Microsoft.VisualStudio.ErrorHandler.CallWithCOMConvention(Action method, Boolean reportError))

当前环境下,除DAX查询外,MDX、DMX、XMLA查询功能均可正常使用。

已尝试的排查操作
  • 单独重装SSMS,问题仍未解决
  • 按以下顺序操作后,问题仍然存在:
    • 卸载搭载SQL Server Data Tools(SSDT)的Visual Studio 2019
    • 卸载SSMS
    • 重新安装搭载SSDT的Visual Studio 2019
    • 重新安装SSMS
      目前公开渠道未检索到匹配的有效解决方案,求可落地的排查或修复方法。
环境信息

SSMS 组件版本

SQL Server Management Studio: 15.0.18333.0
SQL Server Management Objects (SMO): 16.100.37971.0
Microsoft Analysis Services Client Tools: 15.0.19153.0
Microsoft Data Access Components (MDAC): 10.0.18362.1
Microsoft MSXML: 3.0 6.0 
Microsoft .NET Framework: 4.0.30319.42000
Operating System: 10.0.18363

Visual Studio 2019 组件版本

Microsoft Visual Studio Professional 2019
Version 16.6.5
VisualStudio.16.Release/16.6.5+30320.27
Microsoft .NET Framework
Version 4.8.03752
Installed Version: Professional

Microsoft Visual Studio Tools for Applications 2019
Microsoft Visual Studio Tools for Applications 2019

SQL Server Analysis Services   15.0.19126.0
Microsoft SQL Server Analysis Services Designer 
Version 15.0.19126.0

SQL Server Data Tools   16.0.62006.03190
Microsoft SQL Server Data Tools

SsmsVsIntegration   1.0
可落地的修复方案
  1. 重置SSMS用户配置缓存
    • 完全关闭所有SSMS进程,确保无后台残留进程
    • 打开文件资源管理器,定位到 %AppData%\Microsoft\SQL Server Management Studio 路径
    • 找到对应v18版本的配置文件夹(如 15.0),将其重命名为 15.0_backup,强制SSMS启动时重新生成默认配置
    • 重启SSMS,测试新建DAX查询功能是否恢复正常
  2. 对齐Analysis Services客户端组件版本
    • 当前环境存在组件版本差:SSMS自带的Analysis Services Client Tools版本为15.0.19153.0,独立安装的SSDT对应的Analysis Services组件版本为15.0.19126.0,版本不一致会触发编辑器初始化时的空引用报错
    • 安装最新版本的 Analysis Services 客户端库(AMO、ADOMD.NET),确保所有Analysis Services相关组件版本完全对齐
  3. 升级SSMS至无已知bug的正式版本
    • v18.5.1版本存在已知的DAX编辑器加载冲突bug,会触发WPF文本编辑器组件的空引用错误
    • 升级SSMS至v18.9.1及以上的稳定版本,安装时注意不要降级或安装不兼容的旧版SSDT组件
  4. 临时替代方案
    • 若需紧急使用DAX查询功能,可通过Visual Studio 2019中已安装的SSDT模块直接连接Analysis Services实例,新建DAX查询窗口使用,该调用路径不受SSMS内部组件冲突影响

内容的提问来源于stack exchange,提问作者jackie4u

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.12.05 13:54:03