-2

In my VB.NET application I have a class called Letter. In the constructor of the Letter class I initialize new word.application object.

Sub New()
    _application = New Word.Application
End Sub

Recently I started to get a COM exception/error - Call was rejected by callee. After doing my research I have implemented the solution suggested in the following link:

Call was rejected by callee PowerPoint Automation

After the implementation I have the following code:

Sub New()
    MessageFilterAPI.RegisterMessageFilter()
    _application = New Word.Application
    MessageFilterAPI.RevokeMessageFilter()
End Sub

This stopped error appearing on my machine (dev environment), but other machine where the software is installed still gets the error. Full exception message:

Creating an instance of the COM component with CLSID {000209FF-0000-0000-C000-000000000046} from the IClassFactory failed due to the following error: 80010001 Call was rejected by callee. (Exception from HRESULT: 0x80010001 (RPC_E_CALL_REJECTED))

When debugging on the initializing line _application = New Word.Application program completely crashes and freezes with the following exception:

The runtime has encountered a fatal error. The address of the error was at 0x74444ba1, on thread 0x5e48. The error code is 0xc0000005. This error may be a bug in the CLR or in the unsafe or non-verifiable portions of user code. Common sources of this bug include user marshaling errors for COM-interop or PInvoke, which may corrupt the stack.

Anyone has an idea why this is happening? This code hasn't been changed in years and it suddenly became an issue.

Community
  • 1
  • 1
Rasa Rin
  • 86
  • 3
  • 8

1 Answers1

2

This is usually memory issues or corrupted installation. So I'll try to reinstall Office and run "memtest86" to test memory on machine, that shows 0xc0000005 error

Alexander
  • 31
  • 3
  • Thanks for pointing me to right direction. I was initializing word application object couple of times in the loop and not disposing/closing it properly. I had lots of them opened and running in the background (checked task manager). After I closed down all opened word processes and sorted outy code, issue was solved. – Rasa Rin May 28 '15 at 14:51