Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

C# COM Office Automation - RPC_E_SYS_CALL_FAILED

Tags:

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!

like image 351
Roy Tang Avatar asked Sep 19 '08 03:09

Roy Tang


1 Answers

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:

  • Implementing IMessageFilter in an Office add-in and
  • Why your COMAddIn.Object should derive from StandardOleMarshalObject
like image 133
Dirk Vollmar Avatar answered Sep 30 '22 16:09

Dirk Vollmar