C # COM Office Automation - RPC_E_SYS_CALL_FAILED

I am writing a C # program that acts like 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 could not find specific advice on what to do with this error or how to avoid it. From Googling, it looks like something like a message queue or single-threaded apartments. Or am I away?

Example error message:

Failed to make a system call. (Exception from HRESULT: 0x80010100 (RPC_E_SYS_CALL_FAILED))
at Microsoft.Office.Interop.PowerPoint._Presentation.get_FullName ()

Unfortunately, the problem occurs on the client machine, so I have no easy way to debug it! Should I just repeat the calls whenever I get this error?

Any advice that will help me solve this problem would be greatly appreciated!

+4
source share
4 answers

I do not know what this is due to your problem, but all your COM calls should come from the same thread over which the add-in was added. If you have created new topics, you should be especially careful. Details are described in these two articles:

+5
source

Are you making a call from a stream with its ApartmentState set? if not, it could be a culprit - COM interaction is pretty subtle regarding this kind of

0
source

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

0
source

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

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

0
source

Source: https://habr.com/ru/post/1276910/


All Articles