Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Error HRESULT E_FAIL has been returned from a call to a COM component VS2012 when debugging

I have been getting this a lot lately. I've been having to create a new file and move the code to the new file to get around it.

I fixed it by deleting the solution's suo file (as far as I can tell, it just stores info like what files are open in the IDE and stuff, and deleting it does no real damage).

My file was seemingly corrupt. (The IDE wouldn't remember what files were open when restarting. It was 1.7MB in size, which seems large, even for my 40 project solution, which rarely has more than 50 files open at once.)

Edit: I just recently had to do this in VS2017 but for another reason, it was taking longer to build and took 5+ minutes to stop a debug session, deleting that pesky suo file fixed it right up, now anytime VS acts weird deleting SUO is my first port of call.


I had the same problem with a c++ project in Visual Studio 2019.

The following solution worked for me:

  • Close Visual Studio.
  • Go to the project's root folder and delete the .vs directory.
  • Start Visual Studio and open the solution.
  • The build should now work.

I removed the csproj.user files and it worked for me.

In some other cases, to fix this error, I go to Web tab in the project properties and check "Use Visual Studio Development Server" and "Auto-assign Port". After that I need to rebuild the project and restart VS


This solved my problem:

Start —> Run —> regsvr32 %SystemRoot%\System32\msxml3.dll

Start —> Run —> regsvr32 %SystemRoot%\SysWOW64\msxml3.dll

Before this I tried the above solution from Simon, but didn't work for me!

Perhaps combining these two solutions did the job!


Sorry to revive a dead thread but i solved this on VS2017 by deleting the project template cache and item template cache folders in

%localappdata%\Microsoft\VisualStudio\[BUILD]

Then resetting the visual studio settings via

Tools>Import and export settings>reset all settings

Also ive heard turning off "Lightweight solution load for all projects" can help.


I wanted to add that I encountered this error when opening designer file in WinForms app. My issue was that one of the references in the project was referencing itself. Apparently this can happen as mentioned here

https://social.msdn.microsoft.com/Forums/office/en-US/00aede04-d8cd-4475-8114-4b4792261052/winforms-designer-error-hresult-efail-has-been-returned-from-a-call-to-a-com-component

I removed the reference and it is working fine.