Operation aborted (Exception from HRESULT: 0x80004004 E_ABORT) when setting text in a VS2010 macro

1

Some very simple macros don't work for me in VS2010. For instance if I do:

    DTE.ActiveDocument.Selection.Text = "123"

this will work fine, but if instead I type

    DTE.ActiveDocument.Selection.Text = "//123"

then this fails with the ugly abort message that I included in the title. This is when I run it in a C++ Source Editor window. There is an assortment of symbol characters that all cause the assignment of the text to 'Selection.Text' to fail in this way. There was no problem with this in VS2008.

There appears to be nothing about this on the web though, so I'm thinking that it must be a problem with my setup. I am aware that it is possible to get around the problem by creating an edit point and then using the 'Insert' method, but it's sometimes annoying that I can't just record and run a temporary macro without editing it first.

I'm wondering:

a) Whether anyone else has experienced this?

b) Whether anyone knows of a solution to it, or how to track down a solution?

My addins are: Code Collaborator, VMDebugger, VSBuildStatus - although I'm pretty sure that the problem existed before these were added.

My extensions are: AnkhSVN, CommandingImage, Productivity Power Tools, Visual Assist X, Visual Studio Color Theme Editor - again, as far as I remember, the problem predates most of these extensions being installed.

I am running VS2010 on 64-bit Windows 7.

visual-studio-2010
visual-studio-macros
asked on Stack Overflow Jul 11, 2011 by Coder_Dan

2 Answers

2

I know it is not the answer you are looking for, but just in case somebody needs to get the workaround working:

DTE.ActiveDocument.Selection().TopPoint.CreateEditPoint().Insert("//123")
answered on Stack Overflow Jul 14, 2011 by Christopher Oezbek
0

I started getting this today with macros that have been working just fine (and which I use extensively). I wonder why that would be. Perhaps it is due to a Windows update?

[Update]

The fix by Christopher Oezbek does work for this problem too.

answered on Stack Overflow Jul 28, 2011 by Moe Dubreuil • edited Jul 28, 2011 by Moe Dubreuil

User contributions licensed under CC BY-SA 3.0