VS2010按任意键出错的解决 与 遇到了异常,可能是由某个扩展导致的(转)

参考:

http://blog.sina.com.cn/s/blog_403638c60100muxh.html

http://blog.csdn.net/wangqiulin123456/article/details/8791507

我这里的情况是 xp sp3  vs2010  插件 va svn ,装好之后,启动vs2010  只要编辑一下 它就会有个错误框内容如下:

---------------------------
Microsoft Visual Studio
---------------------------
Visual Studio 遇到了异常。这可能是由某个扩展导致的。






您可以在命令行上使用 /log 参数运行应用程序,然后检查文件“C:Documents and SettingsAdministratorApplication DataMicrosoftVisualStudio10.0ActivityLog.xml”以获取详细信息。
---------------------------
确定   
---------------------------

然后cmd 加 /log 参数运行看ActivityLog.xml红色的部分:

281 ERROR System.InvalidCastException: 无法将类型为“System.__ComObject”的 COM 对象强制转换为接口类型“Microsoft.VisualStudio.TextManager.Interop.IVsTextReplaceEvents”。此操作失败的原因是对 IID 为“{CF9928D9-65AE-4319-A446-94ED5C45ECDE}”的接口的 COM 组件调用 QueryInterface 因以下错误而失败: 不支持此接口 (异常来自 HRESULT:0x80004002 (E_NOINTERFACE))。 在 System.StubHelpers.StubHelpers.GetCOMIPFromRCW(Object objSrc, IntPtr pCPCMD, Boolean& pfNeedsRelease) 在 Microsoft.VisualStudio.TextManager.Interop.IVsTextReplaceEvents.OnReplace(ChangeInput[] pCI) 在 Microsoft.VisualStudio.Editor.Implementation.VsTextBufferAdapter.OnTextBufferChangedHighPriority(Object sender, TextContentChangedEventArgs e) 在 Microsoft.VisualStudio.Text.Utilities.GuardedOperations.RaiseEvent[TArgs](Object sender, EventHandler`1 eventHandlers, TArgs args)     Editor or Editor Extension 2015/01/23 02:09:06.312
282 ERROR System.InvalidCastException: 无法将类型为“System.__ComObject”的 COM 对象强制转换为接口类型“Microsoft.VisualStudio.Editor.Implementation.IVsTextStreamEvents_Private”。此操作失败的原因是对 IID 为“{96FC7D44-BCDD-4F00-AE4D-07E26B2C0E52}”的接口的 COM 组件调用 QueryInterface 因以下错误而失败: 不支持此接口 (异常来自 HRESULT:0x80004002 (E_NOINTERFACE))。 在 System.StubHelpers.StubHelpers.GetCOMIPFromRCW(Object objSrc, IntPtr pCPCMD, Boolean& pfNeedsRelease) 在 Microsoft.VisualStudio.Editor.Implementation.IVsTextStreamEvents_Private.OnChangeStreamText(Int32 iPos, Int32 iOldLen, Int32 iNewLen, Int32 fLast) 在 Microsoft.VisualStudio.Editor.Implementation.VsTextBufferAdapter.OnTextBufferChanged(Object sender, TextContentChangedEventArgs e) 在 Microsoft.VisualStudio.Text.Utilities.GuardedOperations.RaiseEvent[TArgs](Object sender, EventHandler`1 eventHandlers, TArgs args)     Editor or Editor Extension 2015/01/23 02:09:06.312

解决方法:

我的是xp,改注册表:

Windows Registry Editor Version 5.00


[HKEY_CLASSES_ROOTCLSID{73B7DC00-F498-4ABD-AB79-D07AFD52F395}InProcServer32]
@="C:/Program Files/Common Files/Microsoft Shared/MSEnv/TextMgrP.dll"
"ThreadingModel"="Both"


对于32位机器,查找注册表的项:
[HKEY_CLASSES_ROOT/CLSID/{73B7DC00-F498-4ABD-AB79-D07AFD52F395}/InProcServer32],
把它的默认值修改为:C:/Program Files/Common Files/Microsoft Shared/MSEnv/TextMgrP.dll
而对于64位的机器,查找项:
[HKEY_CLASSES_ROOT/Wow6432Node/CLSID/{73B7DC00-F498-4ABD-AB79-D07AFD52F395}/InProcServer32]
把它的默认值修改为:C:/Program Files (x86)/Common Files/Microsoft Shared/MSEnv/TextMgrP.dll

据查应该也可以解决下面这个问题  Microsoft Visual Studio 2010 遇到了异常,可能是由某个扩展导致的

原文地址:https://www.cnblogs.com/gr816/p/5290044.html