Microsoft Visual C++ 2010 Express Always Generating Exceptions

For whatever reason, I was always having problems with Microsoft’s Express edition C++ environment. It would generate an exception immediately after I started to edit any C or C++ source file, or seemingly randomly. Also, the Intellisense seemed like it was flaky, it would start highlighting random crap in comments, as though it was parsing them, and highlighting half-words, and other weird stuff. For a while, I was just sticking to the 2008 Express editions, as this was the path of least frustration.

Immediately after you start typing, an error dialog pops up:

“Visual Studio has encountered an exception. This may be caused by an extension. You can get more information by running the application together with the /log parameter on the command line, and then examining the file ‘[…]ActivityLog.xml’.”

Looking at this, there are two error records:

“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: No such interface supported (Exception from HRESULT: 0x80004002 (E_NOINTERFACE)). at System.StubHelpers.StubHelpers.GetCOMIPFromRCW(Object objSrc, IntPtr pCPCMD, IntPtr& ppTarget, 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: No such interface supported (Exception from HRESULT: 0x80004002 (E_NOINTERFACE)). at System.StubHelpers.StubHelpers.GetCOMIPFromRCW(Object objSrc, IntPtr pCPCMD, IntPtr& ppTarget, 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)”

In any case, there’s a solid fix for this issue:

Microsoft Connect Issue Report

But the summary is this:

On 32-bit Windows:
Go to:
[HKEY_CLASSES_ROOTCLSID{73B7DC00-F498-4ABD-AB79-D07AFD52F395}InProcServer32]
Set (Default) to:
"C:Program FilesCommon FilesMicrosoft SharedMSEnvTextMgrP.dll"

On 64-Bit Windows:
Go to:
[HKEY_CLASSES_ROOTWow6432NodeCLSID{73B7DC00-F498-4ABD-AB79-D07AFD52F395}InProcServer32]
Set (Default) to:
"C:Program Files (x86)Common FilesMicrosoft SharedMSEnvTextMgrP.dll"

Seems that a single registry key defining a critical COM component was missing, for whatever reason. Sigh. Once that’s done, things work fine.

One thought on “Microsoft Visual C++ 2010 Express Always Generating Exceptions”

Leave a Reply to Alexander Cancel reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.