如何诊断和修复Visual Studio 2015崩溃?

我在Windows 10环境中使用Visual Studio 2015。 Visual Studio不断崩溃。 该解决scheme打开罚款,但input几个字母后,我收到一条消息说,发生错误,Visual Studio必须closures。 我在网上search,发现如何在诊断模式下运行VS(devenv / log)。 我试过这个,看到在ActivityLog.xml中的几个错误。 我不知道这些是什么意思,我不能在网上find任何关于它们的东西。 我已经更新了所有的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> 

为了诊断Visual Studio崩溃,您需要生成崩溃转储 ,其中包括Visual Studio的当前状态。

要生成这样的崩溃转储,您可以configurationWindows错误报告生成转储通过运行regedit.exe ,转到HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\Windows Error Reporting\LocalDumps\devenv.exe创build一个stringDumpFolder并给它一个名字像C:\localdumps并创build一个名为DumpType的DWORD 32Bit,并将其设置为2以生成完整转储。

Visual Studio崩溃后,您得到一个转储,安装Windows的debugging工具,这是Windows 10 SDK的一部分 。

在安装过程中,您只需selectDebugging Tools for Windows

在这里输入图像描述

所有其他可以跳过。

现在运行Windbg中的32位/ x86 Windbg.exe(因为Visual Studio是一个32位/ x86应用程序), 设置debugging符号 ,通过File-> Open crash dump(或者CTRL + D )打开dmp并input!analyze -v在buttom的命令行

在这里输入图像描述

现在按ENTER键。 现在Windbg加载所需的debugging符号并分析转储并显示一些数据。 在我的例子中,我看到这个:

 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而VSWindowTitleChanger ,它试图在正确地声明一个窗口之前更改一个窗口的标题,并且访问一个带NULL的对象。 这是一个Visual Studio扩展 ,删除它修复了我在启动时的崩溃。

如果Windbg太复杂,可以使用DebugDiag分析器。 首先下载Debug Diagnostic Tool v2 Update 2 ,现在从C:\Program Files\DebugDiag运行C:\Program Files\DebugDiag ,selectCrashHangDumpAnalysis ,现在点击Add Data Files并select转储。

在这里输入图像描述

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

在这里输入图像描述

如果这完成,它会打开一个报告结果。