I'll start with the error:
Retrieving the COM class factory for component with CLSID {1CF0DE77-8CAE-11D1-82A2-0060083F9B01} failed due to the following error: 80080005 Server execution failed (Exception from HRESULT: 0x80080005 (CO_E_SERVER_EXEC_FAILURE)).
Sometimes (not always), when I am executing a function that is defined by a COM
I get that error and there is no way to solve it.
I have already applied the "rules" in the COM definition:
- To have
Interface
Make sure you have defined in the classes:
[ComVisible(true)] [ClassInterface(ClassInterfaceType.None)] [Guid("XXXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX")] //GUID que se desee [ProgId("NombredeCom")] [ComDefaultInterface(typeof(IInterfaceDefinida))]
Where el GUID
is well defined, it IInterfaceDefinida
is comvisible
and does not give any compilation errors or warnings.
But sometimes the error I have mentioned appears for no apparent reason. How can it be fixed?
If after doing everything indicated in the question it still throws that error, the reason is very simple :
CPU load
After a lot of research I have found little pearls (here the first , second and third ) in which the topic of CPU load is mentioned in passing.
This is not possible to fix directly since it does not depend on the application itself, but you can catch the error:
And at the same time find why there is a high CPU load.