views:

1921

answers:

5

Using Visual Studio 2008 I first encountered this when trying to open a standard save file dialog box in visual basic. So far I've worked around it after fruitless searching. Now I find that any action which would cause a save/open dialog (eg. ctrl-O) also fails. I've searched more and still don't know how to fix it.

Stuff I do know: It's not a Visual Studio error, it apparently can occur in any number of other applications (which is why searching for it is annoying)

It's either .NET or COM related, I tried reinstalling all of .NET with no luck, and I've never mucked around with COM ever, I don't really even know what it is.

Something is missing, misplaced, or it could be DLL version issues.

I really don't want to deal with uninstalling VS2008, or MS Office (as one result I found suggested) or any other big application.

+1  A: 

So, somebody, somewhere is trying to CoCreate some object that it (thinks) it needs to do its job. This may or may not be a Visual Studio object. Since it manifests in the Save / Open dialog it could very well be a shell object.

The most likely explanation is the registry entry for the object has been corrupted in some way, or the dll that exports the object is corrupted in some way. For the latter it could be missing completely, or just in a bad state for some reason.

One thing you can try doing is running regsvr32 on likely candidate DLLs, but that's just shooting in the dark.

Another, more advanced option is to attach a debugger (such as ntsd or windbg) to the Visual Studio process it self and set a breakpoint on CoCreateInstance() in the system dll (make sure to look up its exact signature in the header file—it may be #defined to something else). Then get the GUID for the object that it is passing as the argument to CoCreateInstance(). Looking this up in your registry (or a friends registry that doesn't have this issue) should give you a good idea of what DLL you need to go mess with.

jeffamaphone
Thanks, I'll attempt that, I'll see how it goes
OK, so I attached a windbg and think CoCreateInstance is in Ole32, but it just triggers the breakpoint whenever I give focus to VS...
Well yeah, CCI gets called a lot. You need the one that fails. Use the breakpoint macro to dump the guid. Something like:bp CoCreateInstance "dt GUID esp+0x4;g"You'll have to figure the real offset to the guid on the stack--I used 4 as an ex. This prints the guid and continues.
jeffamaphone
Is there a way to determine that offset that isn't trial and error?
Yes, use dds esp when the first breakpoint hits and find the guid. It'll be one of the values on the stack (C pushes right to left, so). Just dt GUID [addr] each one until you find the guid.
jeffamaphone
You could also set a breakpoint on the ret instruction for CCI and conditionally break only when EAX equals your failure code. See the debuggers.chm entry for bp.
jeffamaphone
+1  A: 

The underlying problem here is that a CoCreateInstance is failing. Without attaching a debugger and breaking in CoCreateInstance it's going to be fairly difficult to track down what the problem is. And even if you spend the time to do this, it's unlikely that you'll be able to fix the error.

I agree that a re-install is a last resort. But an in-between step is to attempt to repair the install. If you re-insert the VS Setup Disk, one of the options will be to "Repair" the installation. You may have to go through Add/Remove Programs to get this option.

A Repair is much faster than uninstall/reinstall and will very likely fix this particular issue.

EDIT

OP reported repair succeeded but did not fix the error. Can you check the event log and see if a more specific error is being generated for this failure?

JaredPar
The repair completed without error, but did not fix the problem.
Nothing shows up in the event log.
+1  A: 

I've faced similar issue with VS 2008 and luckily it got solved with the below solution. Try this!!

Locate devenv.exe. Right click >Properties > Uncheck Disable Visual Themes Option

amritha
A: 

Uncheck Disable Visual Themes didnt work for me, but running in xp compatability mode fixed it. I'm assuming the problem is a missing dll

Bill
A: 

Disable visual themes worked for me. Thanks!

Ken