【问题标题】:How do I diagnose and fix a Visual Studio (for example 2015, 2017) crash?如何诊断和修复 Visual Studio(例如 2015、2017)崩溃?
【发布时间】:2017-10-06 15:39:51
【问题描述】:

我在 Windows 10 环境中使用 Visual Studio 2015。 Visual Studio 经常崩溃。该解决方案可以正常打开,但在输入几个字母后,我收到一条消息,提示发生错误并且必须关闭 Visual Studio。我在网上搜索并找到了如何在诊断模式下运行 VS(devenv /log)。我试过了,在 ActivityLog.xml 中看到了几个错误。我不知道这些是什么意思,我在网上找不到任何关于它们的信息。我已经更新了所有 Visual Studio 扩展,但这并没有帮助。我尝试修复VS,但这也无济于事。谁能解释我如何诊断和解决问题?

这是日志中的错误消息:

  <entry>
    <record>161</record>
    <time>2017/05/08 14:53:38.815</time>
    <type>Error</type>
    <source>Microsoft.VisualStudio.CommonIDE.ExtensibilityHosting.VsShellComponentModelHost</source>
    <description>Still unable to load MEF component DLL: Could not load file or assembly &apos;Microsoft.VisualStudio.Workspaces.Contracts, Version=14.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a&apos; or one of its dependencies. The system cannot find the file specified.</description>
    <path>C:\PROGRAM FILES (X86)\MICROSOFT VISUAL STUDIO 14.0\COMMON7\IDE\EXTENSIONS\RV0KRPV2.PBV\TMLanguage.dll</path>
  </entry>
  <entry>
    <record>162</record>
    <time>2017/05/08 14:53:38.822</time>
    <type>Error</type>
    <source>Microsoft.VisualStudio.CommonIDE.ExtensibilityHosting.VsShellComponentModelHost</source>
    <description>Still unable to load MEF component DLL: Could not load file or assembly &apos;Microsoft.VisualStudio.WindowsAzure.CommonAzureTools.Contracts.1.7, Version=1.7.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a&apos; or one of its dependencies. The system cannot find the file specified.</description>
    <path>C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\IDE\Extensions\2re3mhbz.g1s\Microsoft.VisualStudio.ApplicationInsights.dll</path>
  </entry>
  <entry>
    <record>163</record>
    <time>2017/05/08 14:53:38.830</time>
    <type>Error</type>
    <source>Microsoft.VisualStudio.CommonIDE.ExtensibilityHosting.VsShellComponentModelHost</source>
    <description>Still unable to load MEF component DLL: Could not load file or assembly &apos;Microsoft.VisualStudio.ApacheCordovaTools.Definitions.14.0, Version=14.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35&apos; or one of its dependencies. The system cannot find the file specified.</description>
    <path>C:\PROGRAM FILES (X86)\MICROSOFT VISUAL STUDIO 14.0\COMMON7\IDE\EXTENSIONS\22KH2U4Y.XLJ\Microsoft.VisualStudio.Azure.ConnectedServices.MobileServices.dll</path>
  </entry>

【问题讨论】:

  • create a dump file 并通过运行 !analyze -v 分析 Windbg.exe 中的 dmp
  • 感谢您的回复。恐怕我不知道如何创建转储文件(您的链接没有提供说明),也不知道 Windbg.exe 是什么或如何使用它。不幸的是,我的老板不会让我花时间学习所有这些。我认为我得到的日志已经很好地表明了问题所在,我只是不知道如何解决它。我希望得到特定于 Visual Studio 2015 的答案,例如“转到某个链接并下载 x。这将重新安装您丢失的文件。”
  • apply my .reg file。 Windbg.exe 是 Windows 10 SDK 的一部分
  • 您的问题有什么更新吗?
  • 没有。只有那个项目仍然有这个问题。我正在记事本中编写代码,然后将其复制并粘贴到 Visual Studio 中。

标签: visual-studio visual-studio-2015


【解决方案1】:

要诊断 Visual Studio 崩溃,您需要生成一个 crash dump,其中包括 Visual Studio 的当前状态。

要生成这样的故障转储,您可以通过运行regedit.execonfigure Windows Error Reporting 生成转储,转到HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\Windows Error Reporting\LocalDumps\devenv.exe 创建一个字符串DumpFolder 并为其命名为C:\localdumps 并创建一个DWORD 32Bit 命名DumpType 并将其设置为 2 以生成完整转储。

在 Visual Studio 崩溃并获得转储后,安装适用于 Windows 的调试工具,它们是 Windows 10 SDK 的一部分。

在安装过程中,您只需选择Debugging Tools for Windows

其他的都可以跳过。

现在运行 32 Bit/x86 Windbg.exe(因为 Visual Studio 是 32Bit /x86 应用程序)inside Windbg, setup the debug symbols,通过 File->Open crash dump(或 CTRL+D) 并在命令行的按钮处输入!analyze -v

然后按 ENTER。现在 Windbg 加载所需的调试符号并分析转储并向您显示一些数据。在我的示例中,我看到了这一点:

BUGCHECK_STR:  CLR_EXCEPTION_REMOTE_System.NullReferenceException

DEFAULT_BUCKET_ID:  CLR_EXCEPTION_REMOTE_System.NullReferenceException

PRIMARY_PROBLEM_CLASS:  CLR_EXCEPTION

STACK_TEXT:  
00000000 00000000 Microsoft_VisualStudio_Platform_WindowManagement_ni!Microsoft.VisualStudio.Platform.WindowManagement.DTE.MainWindow..ctor+0x0
00000000 00000000 Microsoft_VisualStudio_Platform_WindowManagement_ni!Microsoft.VisualStudio.Platform.WindowManagement.DTE.WindowBase.CreateMainWindow+0x0
00000000 00000000 Microsoft_VisualStudio_Platform_WindowManagement_ni!Microsoft.VisualStudio.Platform.WindowManagement.WindowManagerService.get_MainWindow+0x0
00000000 00000000 UNKNOWN!EnvDTE._DTE.get_MainWindow+0x1
00aed828 11da97b8 UNKNOWN!VSWindowTitleChanger.VSWindowTitleChangerPackage.DelayedInit+0x90


SYMBOL_NAME:  Microsoft_VisualStudio_Platform_WindowManagement_ni!Microsoft.VisualStudio.Platform.WindowManagement.DTE.MainWindow..ctor

MODULE_NAME: Microsoft_VisualStudio_Platform_WindowManagement_ni

BUCKET_ID:  CLR_EXCEPTION_REMOTE_System.NullReferenceException_Microsoft_VisualStudio_Platform_WindowManagement_ni!Microsoft.VisualStudio.Platform.WindowManagement.DTE.MainWindow..ctor

FAILURE_IMAGE_NAME:  Microsoft.VisualStudio.Platform.WindowManagement.dll

BUCKET_ID_IMAGE_STR:  Microsoft.VisualStudio.Platform.WindowManagement.dll

FAILURE_MODULE_NAME:  Microsoft_VisualStudio_Platform_WindowManagement_ni

BUCKET_ID_MODULE_STR:  Microsoft_VisualStudio_Platform_WindowManagement_ni

FAILURE_FUNCTION_NAME:  Microsoft.VisualStudio.Platform.WindowManagement.DTE.MainWindow..ctor

BUCKET_ID_FUNCTION_STR:  Microsoft.VisualStudio.Platform.WindowManagement.DTE.MainWindow..ctor

BUCKET_ID_PREFIX_STR:  CLR_EXCEPTION_REMOTE_System.NullReferenceException_

因此,Visual Studio 崩溃了,因为模块 VSWindowTitleChanger 中的 System.NullReferenceException 试图在窗口被正确加载并访问为 NULL 的对象之前更改窗口的标题。这是Visual Studio extension,删除它可以解决我在启动时遇到的崩溃问题。

如果 Windbg 过于复杂,可以使用 DebugDiag 分析器。第一次下载Debug Diagnostic Tool v2 Update 2,现在从C:\Program Files\DebugDiag运行DebugDiag.Analysis.exe,选择CrashHangDumpAnalysis,现在点击Add Data Files并选择转储。

在最后一步,点击Start Analysis。现在分析器检查转储

如果这完成了,它会打开一个带有结果的 mht 报告。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2015-09-10
    • 1970-01-01
    • 2017-08-04
    • 1970-01-01
    • 2010-11-14
    • 1970-01-01
    相关资源
    最近更新 更多