Error hresult e fail has been returned from a call to a com component

I have a problem debugging a project migrated from Visual Studio 2010 to 2012. Every time I go to debug it I get the error message: "Error HRESULT E_FAIL has been returned from a call to a COM

I have a problem debugging a project migrated from Visual Studio 2010 to 2012. Every time I go to debug it I get the error message:

«Error HRESULT E_FAIL has been returned from a call to a COM component».

Compiling and running the application in a local IIS server works fine — just cannot debug.

The other change other than moving to VS2012 is I am now using Team Foundation Server for source control and issue tracking — but I cannot see how that would affect it.

I can narrow it down to the following

  • The project file — it has been migrated from VS 2003 as a website project and has been chopped and changed up the different versions
  • Crystal Report runtime library/ some other library

Anyone with any ideas?

halfer's user avatar

halfer

19.7k17 gold badges95 silver badges183 bronze badges

asked Nov 13, 2012 at 13:01

Matt's user avatar

6

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.

answered Apr 3, 2019 at 10:28

datoml's user avatar

datomldatoml

5,4043 gold badges20 silver badges27 bronze badges

3

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.

acl's user avatar

acl

2241 gold badge4 silver badges12 bronze badges

answered Apr 25, 2015 at 0:45

Tim Hall's user avatar

Tim HallTim Hall

1,3601 gold badge9 silver badges13 bronze badges

8

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

answered Feb 2, 2016 at 19:07

Alejandro Haro's user avatar

4

This solved my problem:

Start —> Run —> regsvr32 %SystemRoot%System32msxml3.dll

Start —> Run —> regsvr32 %SystemRoot%SysWOW64msxml3.dll

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

Perhaps combining these two solutions did the job!

answered Jun 11, 2014 at 15:05

Besnik Kastrati's user avatar

1

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%MicrosoftVisualStudio[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.

jabbink's user avatar

jabbink

1,2631 gold badge8 silver badges20 bronze badges

answered Sep 19, 2017 at 8:09

Ricky Divjakovski's user avatar

2

Doh! In case anyone else gets this error when trying to attach to an IIS Website.

Triple check that your hostname is correct, I had forgotten a ‘/’ in (e.g.) http://my.testsite.com

Try this before re-installing Visual Studio like I did.. Terrible error message..

answered Apr 8, 2014 at 3:28

Markive's user avatar

MarkiveMarkive

2,3301 gold badge23 silver badges26 bronze badges

2

Maybe this page helps:

Scenario Two:
The Microsoft Visual Studio 2010 IDE crashes while creating OR debugging a web application project.
This above error occurs because of corrupted Cache of Visual Studio 2010. In order to resolve the issue just delete the project Cache from the below location:

C:Program FilesMicrosoft Visual Studio 10.0Common7IDEProjectTemplatesCache

C:Program Files(x86)Microsoft Visual Studio 10.0Common7IDEProjectTemplatesCache

Then run devenv.exe /setup to re-build the cache.

answered Oct 31, 2013 at 13:32

Simon's user avatar

SimonSimon

1,78620 silver badges35 bronze badges

1

I tried all of the above solutions none work for me, I found the solution here

  • Open ActivityLog.xml by going into

    C:Users{UserName}AppDataRoamingMicrosoftVisualStudio15.{Id} 
    
  • Check if error states that

    "CreateInstance failed for package 
    [ReferenceManagerPackage]Source: 'mscorlib' Description: Could not load type 
     'Microsoft.VisualStudio.Shell.Interop.' from assembly 
     'Microsoft.VisualStudio.Shell.Interop.11.0' 
    
  • Then run this gacutil command through VS Cmd prompt (admin mode):

    1. Navigate to

      C:Program Files (x86)Microsoft Visual Studio2017ProfessionalCommon7IDEPublicAssemblies   
      
    2. Run gacutil -i Microsoft.VisualStudio.Shell.Interop.11.0.dll

Suraj Rao's user avatar

Suraj Rao

29.3k11 gold badges96 silver badges103 bronze badges

answered Nov 1, 2018 at 7:54

dawncode's user avatar

dawncodedawncode

5688 silver badges22 bronze badges

1

It seems that to bring up the Add Reference dialog in Visual Studio 2017 the Microsoft.VisualStudio.Shell.Interop.11.0.dll needs to be regsitered in the GAC. You can follow these steps to register this assembly in the GAC:

Open the Develop Command Prompt for VS2017 (ensure you run the as administrator otherwise the GAC registration may fail)

Change the current directory to the PublicAssemblies folder for your Visual Studio 2017 installation. Mine was:

C:Program Files (x86)Microsoft Visual Studio2017EnterpriseCommon7IDEPublicAssemblies

Run the following command to register the assembly in the GAC:

gacutil -i Microsoft.VisualStudio.Shell.Interop.11.0.dll

C:Program Files (x86)Microsoft Visual Studio2017CommunityCommon7IDEPublicAssemblies>gacutil -i Microsoft.VisualStudio.Shell.Interop.11.0.dll
Microsoft (R) .NET Global Assembly Cache Utility. Version 4.0.30319.0
Copyright (c) Microsoft Corporation. All rights reserved.

Assembly successfully added to the cache

Now restart VS2017 and try to add a reference to your project again and you should see the Add Reference dialog appear.

For more clarification please follow below link

How to fix “The operation could not be completed” error adding references to Visual Studio 2017

answered Sep 5, 2019 at 17:54

Sharad Tiwari's user avatar

1

I had the same issue after an upgrade from VS2013 to VS2015.

The project I was working at referenced itself. While VS2013 didn’t care, VS2015 didn’t like that and I got that error. After deleting the reference, the error was gone. It took me around 4 hours to find that out…

answered Nov 2, 2016 at 10:51

yiev's user avatar

yievyiev

1264 silver badges9 bronze badges

2

Just delete packages folder.That helped me

answered Sep 20, 2019 at 18:39

alekoo73's user avatar

alekoo73alekoo73

7091 gold badge9 silver badges17 bronze badges

Root Cause:
Microsoft.VisualStudio.Shell.Interop.11.0.dll is missing from GAC.

Solution:
1. Go to start menu and Open Command Prompt for Visual Studio
2. Enter command gacutil -i Microsoft.VisualStudio.Shell.Interop.11.0.dll
3. If in case your system unable to find this dll file then you may download it from Nuget package manager and then can provide the path of dll

All set! hit enter and you’re done!

answered Sep 22, 2019 at 6:03

Dheeraj Bansal's user avatar

In my case, it seems it was because I stashed some files, but some related windows remained open.

Closing all windows and rebuilding solution fixed it for me.

answered Jun 8, 2021 at 0:53

Xavi's user avatar

XaviXavi

1242 silver badges9 bronze badges

1

I wrote a simple program to open different folder while clicking on some specific buttons. I made the file properties as «content» and «copy if newer» to make deployment. So if I installed the exe file in the other software it actually install all of its resources and run the program fine.
So, this is all about my program. While developing this sometimes if I run the program to check, it showed the error

«HRESULT E_FAIL has been returned from a call to a COM component»

and I could not open the designer view. But Somehow I got an easy solution for me. I am not sure whether it will work for other or not.

Here is the solution:

Copy the whole application folder to another location. click on the application file from there.
it will not work since it is just a copy and you will not see the designer

  1. From the solution explorer delete the form1.vb ( or may be a different name if it was changed during developing)
  2. In the solution explorer>right click>add an existing item> browse the file Form1.vb from where the folder is copied ( orginal location)
  3. run the program in the new location. It will work

The problem with this solution if you want to add something and after running the program you find the same error, you have to copy the whole application folder in another location again and follow the above steps

shA.t's user avatar

shA.t

16.4k5 gold badges53 silver badges111 bronze badges

answered Oct 9, 2014 at 15:27

Tousif Ahmed's user avatar

Not sure about the exact reproduction steps for the error (HRESULT E_FAIL has been returned from a call to a COM component), but the solution for me was:

  1. Close Visual Studio and Repair it through Control Panel.
  2. Restart system

After the restart, the error was gone.

halfer's user avatar

halfer

19.7k17 gold badges95 silver badges183 bronze badges

answered Dec 19, 2017 at 21:43

Meghan N.'s user avatar

The error occurred for me after I installed the latest Windows 10 SDK. I was getting the error while building a C++ project using SDK 8.1. In Project properties, I switch to latest 10 SDK. rebuild. That worked. Changed back to 8.1. Rebuild. No error.

answered Aug 8, 2019 at 14:29

Mike L's user avatar

Steps to resolve the issue:

1.Open your solution/Web Application in VS 2012 in administrator mode.

2.Go to IIS and Note down the settings for your application (e.g.Virtual directory name, Physical Path, Authentication setting and App pool used).

3.Remove (right click and select Remove) your application from Default Web Site. Refresh IIS.

4.Go back to VS 2012 and open settings (right click and select properties) for your web application.

5.Select Web.In Servers section make sure you have selected «Use Local IIS Web Server».

6.In Project Url textbox enter your application path (http://localhost/Application Path). Click on Create Virtual Directory.

7.Go to IIS and apply settings noted in step 2. Refresh IIS.

8.Go to VS 2012 and set this project as startup Project with appropriate page as startup page.

9.Click run button to start project in debug mode.

This resolved issue for me for web application which was migrated from VS 2010 to 2012.Hope this helps anyone looking for specific issue.

My machine configuration is:
IIS 7.5.7600.16385

VS 2012 Professional

Windows 7 Enterprise (Version 6.1 — Build 7601:Service Pack 1)

answered Nov 5, 2013 at 3:39

Bhushan's user avatar

1

This happens in our TFS build server some times (Gated check in). It is about workspace folder. I don’t know why but workspace folder access sometimes corrupt. What I am doing to fix issue is deleting TFS build workspaces and deleting relevant workspace folders. TFS build machine then create new workspaces for itself and problem is fixed.

Tousif Ahmed’s solution should work for local builds. Copy application folder to another place should do the same thing what I am doing in TFS build machine.

answered Mar 23, 2015 at 11:26

Levent Sezer's user avatar

Levent SezerLevent Sezer

6011 gold badge8 silver badges10 bronze badges

1

In my case, it appears that this message can be issued by Intellisense in Visual Studio 2013. The screenshot below shows the error at the bottom of VisualStudio 2013 after the first load of a customer project.
VS2013 "ERROR-HRESULT-E Screenshot

I started googling what causes this error, and decided to try deleteing the user.vxproj files as mentioned above. I found however that the project built with no issues, then after exiting and re-loading the project, I no longer received the error. So I’m assuming in my case, it was some corruption due to moving the project from the customers directory tree structure to my local development disk tree structure. The key here is that in my case, the problem was transient. I did NOTHING and the problem appeared to resolve itself. (Not generally a desirable thing as I didn’t fix anything so it might come back).

answered Jun 27, 2016 at 17:10

Ross Youngblood's user avatar

Ross YoungbloodRoss Youngblood

4761 gold badge3 silver badges15 bronze badges

1

I recently spent about 3 hours trying to fix this issue on my ASP.NET app running on local IIS. I had ‘Override application root URL’ specified and I specified the url with an ending forward slash (/) such as http://my.dev.com/. If I saved the project options and came back in it would show the overrided root url as http://http://my.dev.com. Once I removed the last forward slash it started to behave ok and the error went away.

answered Jul 27, 2016 at 14:58

Richard Edwards's user avatar

Richard EdwardsRichard Edwards

1,3791 gold badge17 silver badges29 bronze badges

HRESULT E_FAIL has been returned from a call to a COM component

In my case, it was because i had differents projects with same GUID in my solution. (Project was created by copy/paste)

answered Oct 14, 2016 at 20:06

Alix's user avatar

AlixAlix

3702 silver badges8 bronze badges

My problem manifested with opening Win10 appxmanifest file (no pun intended). Simply installing Windows 10 tools and SDK (go to New->Project->Select Windows->Install Tools) fixed it.

answered Nov 4, 2016 at 16:08

Bruno Samardžić's user avatar

  1. Add on development initiated on x86 architecture or 64 bit system then it will run on 32bit system also.
  2. but if you Add on development initiated on 32 bit system and then you want to do changes on source code in 64 bit
    Note: if you are connected SAP Licence on server system then set the port and set server name through service manager otherwise System will give error:

Connection Context :- Retrieving the COM class factory for component
with CLSID {632F4591-AA62-4219-8FB6-22BCF5F60090} failed due to the
following error: 80040154 Class not registered (Exception from
HRESULT: 0x80040154 (REGDB_E_CLASSNOTREG)).

Khalil M's user avatar

Khalil M

1,7222 gold badges21 silver badges34 bronze badges

answered Nov 16, 2016 at 9:39

Krishn Kumar Gupta's user avatar

I fixed the same issue by deleting ComponentModelCache folder

  1. Close Visual Studio (if you haven’t done so already out of despair)
  2. Open a file explorer window and navigate toyour AppData folder. You can get there by:
    1. In the search bar, type %APPDATA%/.. and press enter
    2. Alternatively, navigate to C:Users\AppData
  3. Go into LocalMicrosoftVisualStudio<version> where is 12.0 for Visual Studio 2013.
  4. Delete the ComponentModelCache folder.

From here: http://withmartin.net/how-visual-studios-component-model-cache-can-be-a-pain/

Max's user avatar

Max

20.5k4 gold badges49 silver badges66 bronze badges

answered Jun 7, 2017 at 16:48

user2592899's user avatar

I faced the same issue in Visual Studio 2017,
Do follow these steps:

  1. Start —> Run —> regsvr32 %SystemRoot%System32msxml3.dll

  2. Start —> Run —> regsvr32 %SystemRoot%SysWOW64msxml3.dll

  3. Clean the Project.

  4. Restart visual studio.

    Step 1 and 2 were copied from Besnik Kastrati post.

Community's user avatar

answered Dec 2, 2018 at 12:11

Salman Saleh's user avatar

I find this answer
click Ctrl+Alt+J
click (…) in the top
now you can add dll from Browse , .Net or another
After clicking the OK button click at (add to references in selected Project in solution explorer) (this is a green plus «+» button)

answered Jun 13, 2019 at 22:24

Behnam Gorbani's user avatar

I got this error when trying to install a nuget package that I had previously downloaded and installed in another project.

Clicking Clear all NuGet Cache(s) under Tools > Options > NuGet Package Manager solved this for me

answered Dec 10, 2019 at 10:00

Bean's user avatar

BeanBean

615 bronze badges

2

I encountered this error after installing VS2019 but while trying to open a large solution (20+ projects), with both vcxproj and csproj projects, that target VS2015. The csproj all loaded fine, while the vcxproj all failed with the OP’s error. Deleting the .vs folder did not work.

What did work was setting VC++’s «Fallback Location», under the «Browsing Database Fallback» settings.

Tools (menu)
-Options...
--Text Editor
---C/C++
---Advanced
----Browsing Database Fallback
-----Fallback Location

I set mine to D:VC++v16. Where I use v140 for VS2015 and v141 for VS2017. Also set «Always Use» and «Do not warn».

answered Jun 13, 2020 at 4:59

kornman00's user avatar

kornman00kornman00

80810 silver badges27 bronze badges

And back to the error with no meanings:

I’ve created a document, published it on an IIS, and opened it from the IIS, resolved the security problems, and now facing this error message:

Error HRESULT E_FAIL has been returned from a call to a COM component.

************** Exception Text **************

System.Runtime.InteropServices.COMException (0x80004005): Error HRESULT E_FAIL has been returned from a call to a COM component.

   at Microsoft.Office.Core.CommandBarControls.Add(Object Type, Object Id, Object Parameter, Object Before, Object Temporary)

   at CreditCommentsDoc.ThisDocument.ThisDocument_Startup(Object sender, EventArgs e)

   at Microsoft.Office.Tools.Word.Document.OnStartup()

   at CreditCommentsDoc.ThisDocument.FinishInitialization()

   at Microsoft.VisualStudio.Tools.Applications.Runtime.AppDomainManagerInternal.ExecutePhase(String methodName)

   at Microsoft.VisualStudio.Tools.Applications.Runtime.AppDomainManagerInternal.ExecuteCustomization(IHostServiceProvider serviceProvider)

When the document runs from my machine, it runs just fine

According to the error message, there was a problem, adding a button to the toolbar, and that’s it, figure it out, you are on your own.

Thank you for the meaningful errors MS, if one day I am writing an application that will be used by Microsoft; I will defiantly make sure I’ll remember that :-)

Ok, I am not that bad :-)

Background

Using Visual Studio 2019 and needing to add references to components, I accessed the “Add Reference” menu option but got the error noted below.

Image

Textual

Error HRESULT E_FAIL has been returned from a call to a COM component.

TroubleShooting

Google Search

I googled on the error.

Unfortunately, the most popular Google match, a stack overflow QA post, provided too many suggestions and it was difficult to wield through each of the remediative steps.

BTW, that post is here:-

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

Simplified

Upon trying out a couple of tracks mentioned in the StackOverflow post, and not finding any joy, I knew I had to simplify my scenario a lot more and return to the basics.

Outline

Here are the steps we took towards simplicity:-

  1. Visual Studio – Create New Project
    • Closed the current solution
    • Created a new project
      • A simple .Net Console Project
      • Choices
        • .Net Core ( No )
        • .Net Framework ( Yes )
  2. Visual Studio – Add Reference
    • In Visual Studio, choose to add a new Reference
      • Click on “Add Reference”
  3. ActivityLog.XML

Visual Studio – Create New Project

Images

Image – Create a New Project

Image – Configure Your New Project

Visual Studio – Add Reference

Steps

  1. Accessed the Add Reference menu option and got an error
  2. Error
    • Title
      • The ‘ReferenceManagerPackage’ package did not load correctly.
    • Message
      • The problem may have been caused by a configuration change or by the installation of another extension.
      • You can get more information by examining the file ‘c:usersdadenijiAppDataRoamingMicrosoftVisualStudio16.0_9919f19dActivityLog.xml’
  3. Error Explanation
    • Error Text
      • c:usersdadenijiAppDataRoamingMicrosoftVisualStudio16.0_9919f19dActivityLog.xml
    • Error Template
      • c:users<username>AppDataRoamingMicrosoftVisualStudio<version>ActivityLog.xml

Images

Image – The ‘ReferenceManagerPackage’ package did not load correctly

ActivityLog.xml

Entry

CreateInstance failed for package [ReferenceManagerPackage]Source: ‘mscorlib’ Description: Could not load type ‘Microsoft.VisualStudio.Shell.Interop.IVsReferenceManager2’ from assembly ‘Microsoft.VisualStudio.Shell.Interop.11.0, Version=11.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a’. System.TypeLoadException: Could not load type ‘Microsoft.VisualStudio.Shell.Interop.IVsReferenceManager2’ from assembly ‘Microsoft.VisualStudio.Shell.Interop.11.0, Version=11.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a’. at System.Reflection.RuntimeAssembly.GetType(RuntimeAssembly assembly, String name, Boolean throwOnError, Boolean ignoreCase, ObjectHandleOnStack type) at System.Reflection.RuntimeAssembly.GetType(String name, Boolean throwOnError, Boolean ignoreCase) at System.Activator.CreateInstanceFromInternal(String assemblyFile, String typeName, Boolean ignoreCase, BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture, Object[] activationAttributes, Evidence securityInfo) at System.AppDomain.CreateInstanceFrom(String assemblyFile, String typeName)

Image

Key Data

The key data from our error is that a type “Microsoft.VisualStudio.Shell.Interop.IVsReferenceManager2” could not be loaded.

And, that type is part of the “Microsoft.VisualStudio.Shell.Interop.11.0, Version=11.0.0.0, Culture=neutral”

Remediation

Outline

  1. Launch Visual Studio Command Prompt in Administrator Mode
  2. Determine the folder where our assembly ( Microsoft.VisualStudio.Shell.Interop.11.0 ) is located
  3. Change the contextual folder to the identified folder
  4. Register the assembly in GAC ( gacutil )

Launch Visual Studio Command Prompt

Outline

  1. Please launch command prompt preferably “Developer Command Prompt for VS < Version >
    • <Version> standing for the version number of your Visual Studio
  2. Confirm Command Shell (    )
    • The command shell should indicate “Administrator” by reading “Administrator:

Images

Image – Command Prompt – Search

Image – Command Prompt – Shell

Find Microsoft.VisualStudio.Shell.Interop.<Major>.<Minor> ( Microsoft.VisualStudio.Shell.Interop.11.0 )

Outline

  1. Find Microsoft.VisualStudio.Shell.Interop.<Major>.<Minor>
  2. In our case “Microsoft.VisualStudio.Shell.Interop.11.0
  3. There are a few options for looking for a file
    • In this post, we will use the where command

Command

Command – Where

Outline
  1. The syntax for using the where command is
    • option
      • /r ( recursive )
    • Base Folder
    • Filename
Syntax
where /r <folder-base> <filename>

Sample
where /r c: "Microsoft.VisualStudio.Shell.Interop.11.0.dll"

Output

Output – Image

Output – Textual

where /r c: “Microsoft.VisualStudio.Shell.Interop.11.0.dll”

c:Program Files (x86)Microsoft SQL Server Management Studio 18Common7IDEPublicAssembliesMicrosoft.VisualStudio.Shell.Interop.11.0.dll

c:Program Files (x86)Microsoft Visual Studio2017SQLCommon7IDEPublicAssembliesMicrosoft.VisualStudio.Shell.Interop.11.0.dll

c:Program Files (x86)Microsoft Visual Studio2019CommunityCommon7IDEPublicAssembliesMicrosoft.VisualStudio.Shell.Interop.11.0.dll

c:Program Files (x86)Microsoft Visual Studio2019ProfessionalCommon7IDEPublicAssembliesMicrosoft.VisualStudio.Shell.Interop.11.0.dll

Explanation

In our case, we have four matches for Microsoft.VisualStudio.Shell.Interop.11.0.dll.

Those are:-

  1. Microsoft – SQL Server Management Studio
    • Microsoft SQL Server Management Studio – Version 18
  2. Microsoft – Visual Studio
    • Microsoft Visual Studio 2017
    • Microsoft Visual Studio 2019
      • Edition – Community
      • Edition – Professional

Change Directory

Syntax

cd "c:Program Files (x86)Microsoft Visual Studio<version>ProfessionalCommon<version2>IDEPublicAssemblies"

Sample

cd c:Program Files (x86)Microsoft Visual Studio2019ProfessionalCommon7IDEPublicAssemblies"

Output

Image

Register Assembly ( gacutil )

Outline

  1. Issue gacutil against assembly
  2. Review gac for the presence of the assembly

Register Assembly ( gacutil )

Syntax

gacutil -i Microsoft.VisualStudio.Shell.Interop.<versionMajor>.<versionMinor>.dll

Sample

gacutil -i Microsoft.VisualStudio.Shell.Interop.11.0.dll

Output

Image

Textual
Assembly successfully added to the cache.

Review Assembly ( gacutil )

Outline

Please review the registered assemblies in GAC by issuing “gacutil -l“.

Specific Assembly

Syntax
gacutil -l <assembly>

Sample
gacutil -l Microsoft.VisualStudio.Shell.Interop.11.0.dll

Output
Image

Textual
>gacutil.exe -l  "Microsoft.VisualStudio.Shell.Interop.11.0"
Microsoft (R) .NET Global Assembly Cache Utility.  Version 4.0.30319.0
Copyright (c) Microsoft Corporation.  All rights reserved.

The Global Assembly Cache contains the following assemblies:
  Microsoft.VisualStudio.Shell.Interop.11.0, Version=11.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL

Number of items = 1

Matching Assemblies

Syntax
gacutil -l | findstr <assembly>

Sample
gacutil -l | findstr "Microsoft.VisualStudio.Shell.Interop."

Output
Image

Textual
>gacutil.exe -l | findstr "Microsoft.VisualStudio.Shell.Interop"

  Microsoft.VisualStudio.Shell.Interop.10.0, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL

  Microsoft.VisualStudio.Shell.Interop.11.0, Version=11.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL

  Microsoft.VisualStudio.Shell.Interop, Version=7.1.40304.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a

  Microsoft.VisualStudio.Shell.Interop.8.0, Version=8.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a

  Microsoft.VisualStudio.Shell.Interop.9.0, Version=9.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a

>

Confirmation

Let us go confirm.

We do so by exiting our Visual Studio Session, restarting Visual Studio, and attempting to add a Reference.

References

  1. Microsoft
    • Visual Studio Community
      • ReferenceManagerPackage failed to load
        Link
      • Add a reference raise error: Error HRESULT E_FAIL has been returned from a call to a COM component
        Link
  2. Stack Overflow
    • Error HRESULT E_FAIL has been returned from a call to a COM component VS2012 when debugging
      Link
  3. Cameron Dwyer
    • How to fix “The operation could not be completed” error adding references to Visual Studio 2017
      Link
  4. SS64
    • Where Command
      Link
  • Remove From My Forums
  • Question

  • We’ve recently deployed MIIS and VB to a new server and everything operates fine except for when I try and run my AD_MA to import/export from/to AD.  I get a prompt with the error «Error HRESULT E_FAIL has been returned from a call to COM component».  When i click OK, MIIS shows the error «stopped-server».  My last environment never had this problem.  Does this have something to do with the installation?  The only differences I can think of is that our last environment had SQL Server on the Server and had a full VBStudio whereas our new server has the minimum (see below)  and SQL Server is on a remote server.

    Currently on server…

    — Microsoft Visual Basic 2005
    — Microsoft Visual Web Developer 2005
    — Crystal Reports for Visual Studio 2005

    Thoughts? 

Answers

  • This actually turned out to be an issue with accidentally pointing MIIS to the Developers edition of SQL Server on a different box.  Since the thread count is so low on the Dev Edition, we kept running into locks and thread issues.

    When we pointed it to a Standard Edition of SQL Server on a different box, the errors stopped and the performance was as expected.

Error HRESULT E_FAIL is a common error in VS that Microsoft is yet to address/fix. A fix I found on Visual Studio 2019 Version 16.2.4 (Updated Aug 2019).

One day I was in a project and I needed to add a reference to the current project and when doing so was presented with the following error:

Error HRESULT E_FAIL

Error HRESULT E_FAIL

HRESULT E_FAIL has been returned from a call to a COM component

I followed every single post online on how to fix this issue but they were all the same, not one post helped. I tried everything from a reinstall, cleaning the registry, deleting folders from ProgramData/AppData/ .vs Folder or even Program Files (x86), yet none of the issues help.

These are the steps that I’ve taken to add a reference to a project, even though it gets added, if I try to add a reference by right clicking and choosing the add reference I still get the same error!

          1. Press and Hold the following sequence in VS2019 Cntrl+Alt+J
          2. This opens the Object Browser
          3. Reviewing the image below click on the dots below the yellow dot

  1. You will now see a window that says Edit Custom Component Set

  1. All you need to do in the browse section is choose the reference

  1. Once you’ve specified the reference click on Add

  1. Now you’ve to click on Projects next to browse

  1. In this step all you need to do is click on Add again and then press ok
  2. You will now see in the list the reference you’ve added to your project and the name of your project.
  3. For the last step all you need to do is select the reference that you just added
  4. Now press the button below the red dot in the image below

  1. Add to References in Selected Project in Solution Explorer
  2. You will now get a message that you’ve added the reference to your current project, that’s it.

Summary

Even after going through all of those steps, if you still try and right click to add a reference, you still get the Error HRESULT E_FAIL has been returned from a call to a COM component error. I am surprised that after all this time Microsoft hasn’t fixed this issue. But the fix works from the current version. I did try using previous versions but since this is the latest I opted to use VS2019 instead.

When I try to Add a reference in Visual Studio Community 2019 , I got this error:

error HRESULT E_Fail has been returned from a call to a COM Component

First time I got following error:

Update:

Following is logged in activity log:

  <entry>
    <record>746</record>
    <time>2020/05/09 14:25:04.299</time>
    <type>Error</type>
    <source>VisualStudio</source>
    <description>CreateInstance failed for package [ReferenceManagerPackage]Source: &apos;mscorlib&apos; Description: Could not load type &apos;Microsoft.VisualStudio.Shell.Interop.IVsReferenceManager2&apos; from assembly &apos;Microsoft.VisualStudio.Shell.Interop.11.0, Version=11.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a&apos;. System.TypeLoadException: Could not load type &apos;Microsoft.VisualStudio.Shell.Interop.IVsReferenceManager2&apos; from assembly &apos;Microsoft.VisualStudio.Shell.Interop.11.0, Version=11.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a&apos;.    at System.Reflection.RuntimeAssembly.GetType(RuntimeAssembly assembly, String name, Boolean throwOnError, Boolean ignoreCase, ObjectHandleOnStack type)    at System.Reflection.RuntimeAssembly.GetType(String name, Boolean throwOnError, Boolean ignoreCase)    at System.Activator.CreateInstanceFromInternal(String assemblyFile, String typeName, Boolean ignoreCase, BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture, Object[] activationAttributes, Evidence securityInfo)    at System.AppDomain.CreateInstanceFrom(String assemblyFile, String typeName)</description>
    <guid>{48D4A2C1-02AD-4F18-9153-620511BACB7B}</guid>
    <hr>80004005 - E_FAIL</hr>
    <errorinfo></errorinfo>
  </entry>

Views:
30168

Total Answered:
4

Total Marked As Answer:
1


Posted On:
09-May-2020 05:17

In this article, I will solve “Error HRESULT E_FAIL has been returned from a call to a COM component” that you may face in SharePoint Search error logs.

  1. 1
    Error HRESULT E_FAIL has been returned from a call to a COM component

    1. 1.1
      Cause

    2. 1.2
      Solution


In SharePoint, I have performed a Full Crawl Search that has been finished properly, but I got this error

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

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

Cause

The SharePoint Web Application ASP.NET Impersonation status has been disabled.

Solution

  • Start > Administrative Tools > IIS Manager.
  • Navigate to the SharePoint web application >  Authentication > Select Asp.Net Impersonate > For Right side > below Actions > Click on Enable.
Disable ASP.Net Impersonation in IIS
  • Check also the impersonation settings in Web.Config.
Set Impersonate in SharePoint Web.Config
  • Go back to run Full Crawl Search that should be now working properly.

In case, you need to temporarily disable impersonation for a specicifc tasks in your SharePoint solution, you can do that as mentioned at Disable ASP.NET Impersonate using C#


Applies To

  • SharePoint 2016.
  • SharePoint 2013.
  • SharePoint 2010.
See Also
  • SharePoint Configuration Wizard Failed to secure SharePoint Resources.
  • Get the corresponding SharePoint Services Name of the Application Pool GUID.
  • Disable ASP.NET Impersonate using C#.
  • The source was not found, but some or all event logs could not be searched. Inaccessible logs: Security.

@Marusyk , well after I fixed a slight issue in your Main method of the repro projects to use the correct names for the service types (must not have changed from your original project when you created the sample), then I discovered what was going on. It seems the real issue is that you are indeed missing PackageRootConfigSettings.xml in both services

In the «Remove Application» debug mode the platform must be creating this missing Settings.xml files when the package is provisioned as I find them i under the C:SfDevClusterData_App_Node_0PlatformType_App2Stateful.ApiPkg.Config.1.0.0 location (and stateless).

However, when using «Refresh Application» debug mode, we setup symbolic links back to the output bin path and it appears the platform doesn’t create these files automatically when things are provisioned in that mode.

To fix, you can create a new SF service project and copy the Settings.xml file from it into the PackageRootConfig folder of each service. Let me know if that fixes things.

Понравилась статья? Поделить с друзьями:
  • Error host lookup на телевизоре
  • Error hooking port
  • Error homebrew core is a shallow clone
  • Error history report
  • Error hid project can only be used with an usb mcu