Visual Studio在编辑器中输入时崩溃

17

我已经使用VS2010几周了,但过去几天它完全无法使用。当我在编辑器中输入任何内容时,Visual Studio会抛出异常,然后我会收到很多智能感知错误(代码没有问题,如果我在尝试使用编辑器之前运行编译它,那么我就可以编译它)-这是日志信息:

  <entry>
    <record>241</record>
    <time>2011/01/25 08:30:34.109</time>
    <type>Error</type>
    <source>Editor or Editor Extension</source>
    <description>System.InvalidCastException: Unable to cast COM object of type &apos;System.__ComObject&apos; to interface type &apos;Microsoft.VisualStudio.TextManager.Interop.IVsTextReplaceEvents&apos;. This operation failed because the QueryInterface call on the COM component for the interface with IID &apos;{CF9928D9-65AE-4319-A446-94ED5C45ECDE}&apos; failed due to the following error: No such interface supported (Exception from HRESULT: 0x80004002 (E_NOINTERFACE)).&#x000D;&#x000A;   at System.StubHelpers.StubHelpers.GetCOMIPFromRCW(Object objSrc, IntPtr pCPCMD, Boolean&amp; pfNeedsRelease)&#x000D;&#x000A;   at Microsoft.VisualStudio.TextManager.Interop.IVsTextReplaceEvents.OnReplace(ChangeInput[] pCI)&#x000D;&#x000A;   at Microsoft.VisualStudio.Editor.Implementation.VsTextBufferAdapter.OnTextBufferChangedHighPriority(Object sender, TextContentChangedEventArgs e)&#x000D;&#x000A;   at Microsoft.VisualStudio.Text.Utilities.GuardedOperations.RaiseEvent[TArgs](Object sender, EventHandler`1 eventHandlers, TArgs args)</description>
  </entry>
  <entry>
    <record>242</record>
    <time>2011/01/25 08:30:34.125</time>
    <type>Error</type>
    <source>Editor or Editor Extension</source>
    <description>System.InvalidCastException: Unable to cast COM object of type &apos;System.__ComObject&apos; to interface type &apos;Microsoft.VisualStudio.Editor.Implementation.IVsTextStreamEvents_Private&apos;. This operation failed because the QueryInterface call on the COM component for the interface with IID &apos;{96FC7D44-BCDD-4F00-AE4D-07E26B2C0E52}&apos; failed due to the following error: No such interface supported (Exception from HRESULT: 0x80004002 (E_NOINTERFACE)).&#x000D;&#x000A;   at System.StubHelpers.StubHelpers.GetCOMIPFromRCW(Object objSrc, IntPtr pCPCMD, Boolean&amp; pfNeedsRelease)&#x000D;&#x000A;   at Microsoft.VisualStudio.Editor.Implementation.IVsTextStreamEvents_Private.OnChangeStreamText(Int32 iPos, Int32 iOldLen, Int32 iNewLen, Int32 fLast)&#x000D;&#x000A;   at Microsoft.VisualStudio.Editor.Implementation.VsTextBufferAdapter.OnTextBufferChanged(Object sender, TextContentChangedEventArgs e)&#x000D;&#x000A;   at Microsoft.VisualStudio.Text.Utilities.GuardedOperations.RaiseEvent[TArgs](Object sender, EventHandler`1 eventHandlers, TArgs args)</description>
  </entry>

那么,Visual Studio 什么时候会崩溃? - leppie
2个回答

23

这看起来可能是由于计算机注册表中缺少一些信息导致的问题。如果您访问MS Connect网站,您会找到有关此问题以及解决方案的讨论。

解决方案(从该页面复制):

使用 regedit 查看以下密钥:

在32位Windows上:[HKEY_CLASSES_ROOT\CLSID\{73B7DC00-F498-4ABD-AB79-D07AFD52F395}\InProcServer32]
在64位Windows上:[HKEY_CLASSES_ROOT\Wow6432Node\CLSID\{73B7DC00-F498-4ABD-AB79-D07AFD52F395}\InProcServer32]

"(Default)" 值应为以下之一:
在32位Windows上:"C:\Program Files\Common Files\Microsoft Shared\MSEnv\TextMgrP.dll"
在64位Windows上:"C:\Program Files (x86)\Common Files\Microsoft Shared\MSEnv\TextMgrP.dll"


这个完美地解决了问题。我在使用Visual Studio 2012时突然遇到了上述问题,而这个方法解决了它。 - monoceres
这个键已经存在于我的系统中,但是在输入VB.NET代码时,即使在新创建的项目中,VS2017仍会立即崩溃。这种行为是从一天到另一天出现的。 - Andreas

1

看起来是扩展或插件的问题。先将它们全部禁用,然后逐个重新启用,看是否有其中一个出了问题。


Ho1的答案是正确的,这是与注册表中缺失条目有关的错误,而不是扩展程序问题。 - Noah Richards
谢谢回复,这样做阻止了VD崩溃,但智能感知还是有一段时间疯狂,但现在似乎已经自己解决了,感谢您的帮助! - Eamonn McEvoy
问题始于使用数月后,我认为这是一个VS扩展未正确安装/卸载的问题(我怀疑是我尝试的逆向工程扩展之一)。 - Zac
在我的情况下,这并没有改变什么。即使在安全模式下启动,VS也会立即崩溃。 - Andreas

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接