1 月 2012

VS2010代码编辑窗口第一次编辑操作导致报错的问题

用VS2010打开一个C/C++项目,随便选个源代码文件,编辑,报错提示遇到异常,可能由于某Add-in导致等blah blah blah…,确定无视提示后继续编辑,写完一个函数的proto后IDE卡死,稍候直接大红叉异常,只能强制结束进程。

开始按照提示信息,怀疑是VM Ware的Virtual Debugger插件导致,于是花了一会时间把插件以正常添加/删除方式卸载掉,重启IDE,错误依旧,发现被M$的提示信息误导了!

用VS的命令行方式挂log参数启动,devenv /log,触发错误提示后查看ActivityLog.xml日志,xsl顺利的解析出了2条大红色的错误信息:

System.InvalidCastException: Unable to cast COM object of type ‘System.__ComObject’ to interface type ‘Microsoft.VisualStudio.TextManager.Interop.IVsTextReplaceEvents’. This operation failed because the QueryInterface call on the COM component for the interface with IID ‘{CF9928D9-65AE-4319-A446-94ED5C45ECDE}’ failed due to the following error: 不支持此接口 (Exception from HRESULT: 0x80004002 (E_NOINTERFACE)). at System.StubHelpers.StubHelpers.GetCOMIPFromRCW(Object objSrc, IntPtr pCPCMD, Boolean& pfNeedsRelease) at Microsoft.VisualStudio.TextManager.Interop.IVsTextReplaceEvents.OnReplace(ChangeInput[] pCI) at Microsoft.VisualStudio.Editor.Implementation.VsTextBufferAdapter.OnTextBufferChangedHighPriority(Object sender, TextContentChangedEventArgs e) at Microsoft.VisualStudio.Text.Utilities.GuardedOperations.RaiseEvent[TArgs](Object sender, EventHandler`1 eventHandlers, TArgs args)

 

System.InvalidCastException: Unable to cast COM object of type ‘System.__ComObject’ to interface type ‘Microsoft.VisualStudio.Editor.Implementation.IVsTextStreamEvents_Private’. This operation failed because the QueryInterface call on the COM component for the interface with IID ‘{96FC7D44-BCDD-4F00-AE4D-07E26B2C0E52}’ failed due to the following error: 不支持此接口 (Exception from HRESULT: 0x80004002 (E_NOINTERFACE)). at System.StubHelpers.StubHelpers.GetCOMIPFromRCW(Object objSrc, IntPtr pCPCMD, Boolean& pfNeedsRelease) at Microsoft.VisualStudio.Editor.Implementation.IVsTextStreamEvents_Private.OnChangeStreamText(Int32 iPos, Int32 iOldLen, Int32 iNewLen, Int32 fLast) at Microsoft.VisualStudio.Editor.Implementation.VsTextBufferAdapter.OnTextBufferChanged(Object sender, TextContentChangedEventArgs e) at Microsoft.VisualStudio.Text.Utilities.GuardedOperations.RaiseEvent[TArgs](Object sender, EventHandler`1 eventHandlers, TArgs args)

有了具体错误信息,发现是某个VS编辑COM控件的注册信息丢失导致,最后还算轻松的找到了解决方法:

Continue reading…

MotoDroid的glTexSubImage2D作用贴图尺寸问题

之前用MotoDroid机器的时候曾经发现过一个比较恶心的事,就是glGenTextures函数生成的贴图ID是乱数的问题,后来发现GL官方也说不保证此函数返回值是连续正整数,也就罢了。这次又发现MotoDroid上的glTexSubImage2D函数问题,就是在获取gl信息中的最大贴图尺寸时,ME525和Milestone2都返回2048×2048(其它机型未测),但在贴图尺寸为2048×2048的时候调用glTexSubImage2Dj局部更新贴图时,会出现错误覆盖贴图已有内容的问题,而将贴图尺寸降为1024×1024后就不会出现这种问题了。