When my code tries to create a new instance of Microsoft.Office.Interop.PowerPoint.Application
, I sometimes get the following exception:
System.Runtime.InteropServices.COMException (0x80010001): Retrieving the COM class factory for component with CLSID {91493441-5A91-11CF-8700-00AA0060263B} failed due to the following error: 80010001 Call was rejected by callee. (Exception from HRESULT: 0x80010001 (RPC_E_CALL_REJECTED)).
at System.Runtime.Remoting.RemotingServices.AllocateUninitializedObject(RuntimeType objectType)
at System.Runtime.Remoting.Activation.ActivationServices.CreateInstance(RuntimeType serverType)
at System.Runtime.Remoting.Activation.ActivationServices.IsCurrentContextOK(RuntimeType serverType, Object[] props, Boolean bNewObj)
at System.RuntimeTypeHandle.CreateInstance(RuntimeType type, Boolean publicOnly, Boolean noCheck, Boolean& canBeCached, RuntimeMethodHandleInternal& ctor, Boolean& bNeedSecurityCheck)
at System.RuntimeType.CreateInstanceSlow(Boolean publicOnly, Boolean skipCheckThis, Boolean fillCache)
at System.RuntimeType.CreateInstanceDefaultCtor(Boolean publicOnly, Boolean skipVisibilityChecks, Boolean skipCheckThis, Boolean fillCache)
at System.Activator.CreateInstance(Type type, Boolean nonPublic)
I say sometimes because it doesn't happen consistently even given the same input. Furthermore, it also occurs (with the same lack of consistency) in other parts of my code where I also interact with the PowerPoint automation API.
I have tried out this solution from MSDN itself which seems to be the most recommended solution out there. However, it doesn't seem to have any impact as I still observe the same behavior.
My questions are:
- Does the MSDN solution work for PowerPoint automation?
- How can I verify whether I have correctly applied it to my code?
- Does anyone have an alternative solution?
I am using C#, .NET 4, and PowerPoint 2007.