В результате вызова компонента COM возвращена ошибка в формате HRESULT E_FAIL
Здравствуйте!
Кто сталкивался с такими проблемами в работе с Visual Studio 2022, то помогите, пожалуйста.
При попытке открыть конструктор одной формы возникает ошибка "В результате вызова компонента COM возвращена ошибка в формате HRESULT E_FAIL".
При этом конструктор другой формы тут же загружается нормально
Если же из проекта удалить папки .vc, bin, obj все грузится нормально. Но так нужно делать после каждого запуска, поэтому утомляет.
Все варианты, доступные мне из интернета, проверил. Не помогает.
Хотя бы направление поиска: проблема в конструкторе формы?
Ну и до пары. Бывает приложение не запускается, если не убить процесс, созданный при предыдущем запуске. Но это не так сильно мешает.
Ошибка HRESULT E_FAIL
Смотрел я решение в интернете, но у всех эта ошибка возникает только при компиляции. А меня по.
Неопознанная ошибка (Исключение из HRESULT: 0x80004005 (E_FAIL)
Возникает данная ошибка при вызове функции из dll Прототип функции: int __cdecl Func(struct.
Error HRESULT E_FAIL has been returned from call to a COM component
Проблема следующая: создаю WebSite, кидаю пару контролов на страницу, компилю, мне предлагают.
Что будет вызвано в результате вызова f()?
Дан код со следующим определением класса A: struct A < void f()* метод 1*/> void.
Что будет выведено в результате вызова процедуры
Что будет выведено в результате вызова процедуры Procedure a(var v:char); var c:char; begin.
Пока ошибка исчезла (без видимых причин). Вот что посоветовали на форуме Microsoft
If you try following suggestions, will one of them works?
1. Repair VS.
2. Update VS to the latest version.
3. Try to change to English, just in case the issue is caused by different language package.
4. Try to remove VS cache(navigate to C:\Users\<username>\AppData\Local\Microsoft\VisualStudio\17.0_xxxxxxxx\Component ModelCache folder, backup and remove all "ComponentModelCache" folders), and test again.
5. In case it is a potential issue, please also submit a ticket on our Developer Community for further investigate.
Вдруг кому-то поможет
Сколько двоек выводится на экран в результате вызова функции
В этом году выпускники одиннадцатых классов будут сдавать ЕГЭ по информатике на компьютерах. Одна.
Расширенный отчет о результате вызова функции [Как сделать правильно]
Думаю, достаточно важный вопрос в плане проектирования. Уже столкнулся. Есть у меня допустим.
Определите, сколько звездочек будет напечатано в результате вызова функции F (5)
Определите, сколько звездочек будет напечатано в результате вызова функции F(5): И сама функция.
Сколько символов ’*’ выводится на экран в результате вызова функции или процедур
Рассмотрим функцию, приведенную ниже на трех языках программирования. Python def F( n ): .
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.
Error
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:-
- 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 )
- Visual Studio – Add Reference
- In Visual Studio, choose to add a new Reference
- Click on “Add Reference”
- In Visual Studio, choose to add a new Reference
- ActivityLog.XML
Visual Studio – Create New Project
Images
Image – Create a New Project
Image – Configure Your New Project
Visual Studio – Add Reference
Steps
- Accessed the Add Reference menu option and got an error
- 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’
- Title
- Error Explanation
- Error Text
- c:users\dadeniji\AppData\Roaming\Microsoft\VisualStudio16.0_9919f19d\ActivityLog.xml
- Error Template
- c:users<username>AppDataRoamingMicrosoft\VisualStudio<version>ActivityLog.xml
- Error Text
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
- Launch Visual Studio Command Prompt in Administrator Mode
- Determine the folder where our assembly ( Microsoft.VisualStudio.Shell.Interop.11.0 ) is located
- Change the contextual folder to the identified folder
- Register the assembly in GAC ( gacutil )
Launch Visual Studio Command Prompt
Outline
- Please launch command prompt preferably “Developer Command Prompt for VS < Version >”
- <Version> standing for the version number of your Visual Studio
- Confirm Command Shell ( )
- The command shell should indicate “Administrator” by reading “Administrator:“
Hresult e fail что за ошибка
This forum has migrated to Microsoft Q&A. Visit Microsoft Q&A to post new questions.
- ProfileText
- Sign in
Answered by:
Question
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.
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.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 🙂
Answers
I’m not sure quite what you’re doing here as I don’t have the code you are executing but it seems like you are trying to add a button to the CommandBarControls collection.
If you are doing this from inside a VSTO customization which runs when the document is opened from within IIS then there are any number of reasons this might fail.
VSTO was not designed with this scenario in mind. The core server scenario uses the ServerDocument object to open Word and Excel documents _without_ starting the application and allows the developer to manipulate cached data:
If you could explain further what you’re trying to achieve I may be able to suggest a way to do it.
All replies
I’m not sure quite what you’re doing here as I don’t have the code you are executing but it seems like you are trying to add a button to the CommandBarControls collection.
If you are doing this from inside a VSTO customization which runs when the document is opened from within IIS then there are any number of reasons this might fail.
VSTO was not designed with this scenario in mind. The core server scenario uses the ServerDocument object to open Word and Excel documents _without_ starting the application and allows the developer to manipulate cached data:
If you could explain further what you’re trying to achieve I may be able to suggest a way to do it.
I stopped the modifications over the code, I will try to go to the project later, but here is the idea.
In the server side, I am using the server document to manipulate the document, and after the modifications, this document must go to the client, and the client opens it.
For the client, it is a document coming from IIS, the only difference, this document has a DLL file attached to it.
All what this DLL does, is adding a new button next to the save button, and this button will save the data back to a web service.
So there are 2 projects, one on the server behind IIS, and one that will execute on the client in Word.
The only problem here is the client code cannot modify the Microsoft Word toolbar once the document is opened from IIS using a web browser.
This code can modify the toolbar when the document runs from the local machine.
The solution that I am building is no different from an InfoPath / SharePoint solution, but since the previous 2 are extremely limited and cannot work with large documents (in size), and large amount of documents, we are going to build a solution with Word and ASPX.
Although Word is very powerful when handling large documents, it seems Word has lots of limitations in other areas.
Anyway, thank you for the help, and I hope MS has more descriptive errors in the future, a bit more in the description = lots of saved time to the developer.
Any official response from MSFT? I too am working through this, and if solved will be of tremendous benefit!
I stopped trying actually to run a word document from IIS directly, the VSTO object module is over secured, to a level that makes it useless, and Microsoft Word is not designed to work from IIS.
I found a workaround with click once deployment (to produce reports).
1- Create a Windows application.
2- Reference the Word 11 or Word 12 .net libraries.
3- Use the libraries to show Word and hide your Windows form.
4- Use the click once deployment to publish everything to the IIS and run it from there.
This way you will bypass all the restrictions (the .net security) and all related errors.
Another thing, I am not using Word instead InfoPath, both are too slow, I am using a windows form instead, with the regular controls, and Microsoft Word inside the form (using the Windows API) for the rich text.
At this stage, Microsoft Word is wonderful for reporting, but premature for data entry, there are still tons of things missing.
Excel on the other hand is much advanced, but both need a bit more work from MS.
I appreciate your help very much! Advice from the trenches is most beneficial!
Now question time. In my situation, I have a web-based app that users will need to use to have the system populate documents with context-sensitive data (based on a context-sensitive template), then bring them up for possible editing, then printing. This saves a record of the document, and then at any time, the user can click a link in the app to bring that document up again. (for possible editing or printing) If I can’t use IIS as the container for this document, I was considering causing the linked document to come up in word instead. But, I agree that I will have much more control of a windows application (using windows forms). Do you know of a way that I can, in a web page, cause the execution of a windows executable that is installed on a users machine?
Error HRESULT E_FAIL has been returned from a call to a COM component VS2012 when debugging
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?
33 Answers 33
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 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 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
Then resetting the visual studio settings via
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
I removed the reference and it is working fine.
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 Files\Microsoft Visual Studio 10.0\Common7\IDE\ProjectTemplatesCache
C:\Program Files(x86)\Microsoft Visual Studio 10.0\Common7\IDE\ProjectTemplatesCache
Then run devenv.exe /setup to re-build the cache.
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..
I tried all of the above solutions none work for me, I found the solution here
Open ActivityLog.xml by going into
Check if error states that
Then run this gacutil command through VS Cmd prompt (admin mode):
Run gacutil -i Microsoft.VisualStudio.Shell.Interop.11.0.dll
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:
- Close Visual Studio and Repair it through Control Panel.
- Restart system
After the restart, the error was gone.
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 Studio\2017\Enterprise\Common7\IDE\PublicAssemblies
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 Studio\2017\Community\Common7\IDE\PublicAssemblies>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.