问题描述
我在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 'Microsoft.VisualStudio.Workspaces.Contracts, Version=14.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' 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 'Microsoft.VisualStudio.WindowsAzure.CommonAzureTools.Contracts.1.7, Version=1.7.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' 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 'Microsoft.VisualStudio.ApacheCordovaTools.Definitions.14.0, Version=14.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' 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的当前状态.
要生成此类故障转储,可以配置Windows错误报告,通过运行regedit.exe
生成转储,转到HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\Windows Error Reporting\LocalDumps\devenv.exe
创建字符串DumpFolder
,并给它一个类似于C:\localdumps
的名称,并创建一个名为DumpType
的DWORD 32Bit并将其设置为生成完整转储.
在Visual Studio崩溃并转储之后,请安装Windows调试工具,该工具是 Windows 10 SDK .
在安装过程中,您只需选择Debugging Tools for Windows
其他所有内容都可以跳过.
现在运行32 Bit/x86 Windbg.exe(因为Visual Studio是32Bit/x86应用),在Windbg内部符号,通过File-> Open crash dump(或 + )打开dmp,然后在命令行中的buttom !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_
因此,由于尝试更改标题的模块VSWindowTitleChanger
中的 System.NullReferenceException ,Visual Studio崩溃了正确装载窗口并访问其值为NULL之前的窗口的视图.这是 Visual Studio扩展,将其删除可解决启动时崩溃的问题.
如果Windbg太复杂,则可以使用DebugDiag分析器.第一次下载调试诊断工具v2更新2 ,现在从C:\Program Files\DebugDiag
运行DebugDiag.Analysis.exe
,选择CrashHangDumpAnalysis
,现在单击Add Data Files
并选择转储.
在最后一步中,单击Start Analysis
.现在分析器检查转储
,如果完成,它将打开结果报告.
I'm using Visual Studio 2015 in a Windows 10 environment. Visual Studio is constantly crashing. The solution opens up fine, but after typing a few letters I get a message saying that an error occurred and Visual Studio must be shut down. I searched online and found how to run VS in diagnostic mode (devenv /log). I tried this and see several errors in ActivityLog.xml. I don't know what any of these mean and I can't find anything online about them. I've updated all of the Visual Studio extensions, but that didn't help. I tried repairing VS, but that didn't help either. Can someone explain how I can diagnose and fix the problem?
Here is the error messages in the log:
<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 'Microsoft.VisualStudio.Workspaces.Contracts, Version=14.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' 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 'Microsoft.VisualStudio.WindowsAzure.CommonAzureTools.Contracts.1.7, Version=1.7.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' 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 'Microsoft.VisualStudio.ApacheCordovaTools.Definitions.14.0, Version=14.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' 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>
To diag Visual Studio crashes, you need to generate a crash dump, which includes the current state of Visual Studio.
To generate such a crash dump, you can configure Windows Error Reporting to generate dumps by running regedit.exe
, go to HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\Windows Error Reporting\LocalDumps\devenv.exe
create a string DumpFolder
and give it a name like C:\localdumps
and create a DWORD 32Bit named DumpType
and set it to 2
to generate a Full dump.
After Visual Studio crashed and you got a dump, install the Debugging Tools for Windows, which are part of the Windows 10 SDK.
During Setup you only need to select the Debugging Tools for Windows
all other can be skipped.
Now run 32 Bit/x86 Windbg.exe (because Visual Studio is a 32Bit /x86 applciation), inside Windbg, setup the debug symbols, open the dmp via File->Open crash dump (or +) and type !analyze -v
in the command line at buttom
and now press ENTER. Now Windbg loads the required debug symbols and analyzes the dump and shows you some data. In my example I see this:
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_
So the Visual Studio crashed because of a System.NullReferenceException in the module VSWindowTitleChanger
which tries to change the Title of a Window before it was laoded correctly and accessed an object with was NULL. This is a Visual Studio extension and removing it fixes the crash I had at startup.
If Windbg is too complicated, you can use the DebugDiag analyzer. 1st download the Debug Diagnostic Tool v2 Update 2, now run DebugDiag.Analysis.exe
from C:\Program Files\DebugDiag
, select CrashHangDumpAnalysis
, now click on Add Data Files
and select the dump.
In last step, click on Start Analysis
. Now the analyzer checks the dump
and if this is finished, it opens a mht Report wit the result.
这篇关于如何诊断和修复Visual Studio(例如2015、2017)崩溃?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!