2017-05-08 227 views
2

我在Windows 10環境中使用Visual Studio 2015。 Visual Studio不斷崩潰。該解決方案打開的很好,但輸入幾個字母后,我收到一條消息,指出發生錯誤,Visual Studio必須關閉。我在網上搜索,發現如何在診斷模式下運行VS(devenv/log)。我試過這個,看到ActivityLog.xml中有幾個錯誤。我不知道這些是什麼意思,我也找不到關於它們的任何信息。我已經更新了所有的Visual Studio擴展,但這沒有幫助。我試圖修復VS,但這也沒有幫助。有人可以解釋我如何診斷和解決問題嗎?如何診斷和修復Visual Studio 2015崩潰?

這裏是日誌中的錯誤信息:

<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> 
+0

[創建轉儲文件](https://msdn.microsoft.com/en-us/library/bb513638(VS.85).aspx)並通過運行**!analyze -v來分析W​​indbg.exe中的dmp ** – magicandre1981

+0

謝謝你的回覆。恐怕我不知道如何創建轉儲文件(您的鏈接不提供說明),我不知道Windbg.exe是什麼或如何使用它。不幸的是,我的老闆不會讓我花時間學習所有這些。我認爲我所記錄的日誌已經給出了一個很好的指示,說明問題在哪裏,我只是不知道如何解決它。我希望得到一個特定於Visual Studio 2015的答案,例如「轉到某個鏈接並下載x,這將重新安裝您丟失的文件。」 – boilers222

+0

[應用我的.reg文件](https://pastebin.com/zKuJvw57)。 Windbg.exe是Windows 10 SDK – magicandre1981

回答

6

要診斷的Visual Studio崩潰,你需要生成一個crash dump,其中包括Visual Studio中的當前狀態。

要產生這樣的崩潰轉儲,您可以configure Windows Error Reporting通過運行regedit.exe生成轉儲,去HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\Windows Error Reporting\LocalDumps\devenv.exe創建一個字符串DumpFolder並給它一個名稱,如C:\localdumps並創建一個DWORD 32位命名爲DumpType並將其設置爲2產生一個完全轉儲。

Visual Studio崩潰後,您得到一個轉儲,安裝調試工具的Windows,這是Windows 10 SDK的一部分。

在安裝過程中你只需要選擇Debugging Tools for Windows

enter image description here

所有其他的都可以跳過。

現在運行32位/ 86 WINDBG.EXE(因爲Visual Studio是一個32位/ 86 applciation),inside Windbg, setup the debug symbols,經由打開文件 - >打開的故障轉儲的DMP(或CTRL + d),然後鍵入!analyze -v在BUTTOM

enter image description here

現在命令行按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它試圖將其正確laoded和訪問的對象是與前NULL來改變窗口的標題在System.NullReferenceException的。這是一個Visual Studio extension並刪除它修復了我在啓動時的崩潰。

如果Windbg太複雜,可以使用DebugDiag分析器。第一次下載Debug Diagnostic Tool v2 Update 2,現在運行DebugDiag.Analysis.exeC:\Program Files\DebugDiag,選擇CrashHangDumpAnalysis,現在點擊Add Data Files並選擇轉儲。

enter image description here

在最後一步,點擊Start Analysis。現在的分析檢查轉儲

enter image description here

,如果這個完成後,它會打開一個MHT報告機智的結果。