C# COM Office Automation - RPC_E_SYS_CALL_FAILED

5

I'm writing a C# program that acts as a PowerPoint 2007 plugin. On some machines, some calls to the PowerPoint object model throw a COMException with the message RPC_E_SYS_CALL_FAILED. I couldn't find any specific advice on what to do regarding this error, or how to avoid it. From Googling it looks like something to do with the message queue or Single-Threaded Apartments. Or am I way off?

Example of the error message is:

System call failed. (Exception from HRESULT: 0x80010100 (RPC_E_SYS_CALL_FAILED))
at Microsoft.Office.Interop.PowerPoint._Presentation.get_FullName()

Unfortunately, the problem is occurring on a client's machine, so I have no easy way to debug it! Should I just retry the calls whenever I get this error?

Any advice to help me resolve this problem would be greatly appreciated!

c#
com
ms-office
asked on Stack Overflow Sep 19, 2008 by Roy Tang • edited Jan 27, 2017 by Breeze

4 Answers

5

I don't know it is related to your problem, but all your COM calls must come from within the same thread your add-in was created on. If you created new threads you must take special care. Details are described in these two articles:

answered on Stack Overflow Nov 26, 2008 by Dirk Vollmar • edited Dec 2, 2016 by Dirk Vollmar
0

are you making the call from a thread with its ApartmentState set? if not, that might be the culprit - COM interop is pretty finicky about that sort of thing

answered on Stack Overflow Sep 19, 2008 by Steven A. Lowe
0

What are the security settings of the client? It is quite possible that the security settings of the client (either Windows/OS settings or PowerPoint/App settings) won't allow your plug-in to communicate via RPC.

answered on Stack Overflow Oct 24, 2008 by David B Heise
0

This can very easily happen if you make any calls to the Powerpoint object model from a background thread. One plausible scenario is having a timer that periodically checks some sort of status value. If, when the timer fires, Powerpoint is busy (for example a dialog box is open) the call will fail.

This Microsoft article gives an overview of threading support in Office: http://msdn.microsoft.com/en-us/library/8sesy69e.aspx

answered on Stack Overflow Nov 26, 2008 by Helen Toomik

User contributions licensed under CC BY-SA 3.0